Member-only story
YAML formatting
Generally speaking, in terms of formatting, there are key points covered.
General Formatting (Clean Code)
Vertical formatting:
- Organize code vertically into meaningful sections, with each section representing a complete thought or concept.
- Blank lines can be used to separate different sections and improve readability.
Indentation
- Use consistent and appropriate indentation to show the hierarchical structure of code.
- Indentation should clearly indicate logical relationships between different code blocks.
public class MyClass {
public void doSomething() {
if (condition) {
// Code block
} else {
// Code block
}
}
}
Line length
- Keep lines of code reasonably short (around 80 characters) to avoid horizontal scrolling.
- Long lines can be broken into multiple lines using appropriate syntax without sacrificing readability.
Horizontal formatting
- Use horizontal spacing to improve code readability.
- Properly align elements such as variable assignments or method parameters to make code easier to scan.
Team rules
- Establish a set of team rules or coding standards for formatting to ensure consistency across the codebase.
- Agree on a specific style guide…