Skip to content

Clarify and properly define/enforce code-style #10529

@jschmidt-icinga

Description

@jschmidt-icinga

Currently our style-guide is a bit vague and doesn't reflect many of the style-conventions in our code base. It says its based on the "clang format", which means what IDEs and clang-format refer to as the LLVM style, but the our code-base diverges from that style in many more places than those listed in 21_development.md.

On the request of @julianbrost I've already opened PR #10520 to discuss a possible .clang-format file for this project and it has quickly become apparent that not everyone is on the same page with regards to what conventions should be required (and therefore added to the style-guide) and which recommendation or requirements in the style-guide should be revisited.

This currently includes, but isn't limited to:

  • Multi-line comment format (the style-guide says to use /*\n*/ while our code has multiple lines of // in many places, which would also preferred by the developers
  • The column limit (not in style-guide; no clear convention; ~120 preferred)
  • Pointer/Reference Alignment (not in style-guide; convention is left-aligned)
  • template declarations always on a separate line (not in style-guide; convention)
  • Access modifiers on the same indentation level as the class keyword (not in style-guide; convention)
  • Case labels indentation (not in style-guide; convention is indented one level, compared to LLVM style)
  • etc.

The solution will likely involve adopting a .clang-format file and/or fixing the documentation to align with the lived convention in the code-base. @julianbrost has also talked about adding some automation to pull-requests to validate conforming with clang-format so human reviewers don't have to point out style errors all the time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions