This guide defines code styles and best practices for the UTMStack codebase. You should follow these conventions when writing code.
Code Formatting
- Indent with 4 spaces, not tabs.
- 80 character line length limit.
- Space after keywords like if, while, for, etc.
- Spaces around operators like +, -, *, /.
- Opening braces on same line as control statements.
Naming
- Variable and function names in `lowerCamelCase` (Java, JavaScript, TypeScript).
- Variable and function names in `lower_snake_case` (Python).
- Variable and function names in `lowerCamelCase` (Go).
- Class names in `UpperCamelCase` (All languages).
- Global constants in `ALL_UPPER_SNAKE_CASE` (All languages).
- Descriptive names denoting purpose.
Comments
- Clear comments explaining complex logic.
- Docstring formatted comments for functions and classes in Python.
- Comment out unused code instead of deleting.
Other
- Avoid duplicate code with refactoring.
- Limit function lines when possible.
- Handle errors properly, do not ignore them.
- Remove unused imports.
- Validate user input to prevent errors.
Using a consistent code style across the project makes UTMStack more readable and maintainable.