HomeClusterLabs Projects

Create and refine STYLE_GUIDE.md for project contributions

Description

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:

  1. 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).
  1. 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).
  1. Comments:
    • // for single-line, /* ... */ for multi-line.
    • Emphasizes clear and concise comments for non-obvious code.
  1. Best Practices:
    • API Changes Require Tests: Any internal or external API modification must be accompanied by corresponding tests in the test suite.
  1. 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>

Details

Provenance
google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>Authored on Wed, Jun 4, 12:33 AM
fabbioneCommitted on Wed, Jun 4, 12:36 PM
Parents
rK5e9007681710: Merge pull request #445 from kronosnet/rust-187
Branches
Unknown
Tags
Unknown
References
reformat-style-guide-copyright

Event Timeline

fabbione committed rK37490792ac81: Create and refine STYLE_GUIDE.md for project contributions (authored by google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>).Wed, Jun 4, 12:36 PM