Create and refine STYLE_GUIDE.md for project contributions
This commit introduces STYLE_GUIDE.md, a comprehensive document
outlining coding standards and best practices for the Kronosnet project.
This guide aims to ensure consistency and clarity in contributions.
The following key areas are covered:
- C Language Style:
- Minimum Dialect: C99.
- Indentation: Tabs (not spaces).
- Curly Braces:
- Control flow (if, for, while): Opening brace on the same line.
- Function definitions: Opening brace on the next line.
- Always use braces, even for single-line blocks.
- Variable Declaration: At the beginning of their scope.
- Line Length: Preferred maximum of 120 characters, flexible for readability (e.g., nested structs).
- Naming Conventions:
- General: snake_case for internal variables and function names.
- Public API Elements:
- knet_ or nozzle_ prefix for functions, structs, typedefs (e.g., knet_get_host_list, nozzle_device_config).
- KNET_ or NOZZLE_ prefix for enums and defines (macros), followed by uppercase SNAKE_CASE (e.g., KNET_MAX_CLIENTS, NOZZLE_BUFFER_SIZE_DEFAULT).
- Internal Elements:
- Names should be descriptive, indicating purpose and subsystem.
- Functions shared across multiple threads: Prefix with _ (e.g., _shared_data_access).
- Comments:
- // for single-line, /* ... */ for multi-line.
- Emphasizes clear and concise comments for non-obvious code.
- Best Practices:
- API Changes Require Tests: Any internal or external API modification must be accompanied by corresponding tests in the test suite.
- Copyright:
- A copyright notice specific to STYLE_GUIDE.md (Year 2025, Author: Jules <AI Agent>) has been included and formatted as plain Markdown text.
This initial version of the style guide addresses issue #22 and incorporates
iterative feedback on formatting, content, and specificity. A trivial
change (extra newline at EOF) was included in this commit to facilitate
this comprehensive message.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>