Skip to content
Snippets Groups Projects

docs: Add styleguide.

Merged Felix Weiglhofer requested to merge fweig/cbmroot:styleguide into master
All threads resolved!

Adds styleguide document. I added links to the ALICE styleguide and outlined the changes / exceptions we agreed on.

Additionally some adjustments to clang-format:

  • AccessModifierOffset: -1: Indent access specifier by 1 space. For consistency with ALICE. Not sure this change is necessary. ALICE also formats class brackets differently. And on it's own I don't see any benefit over the current format.
  • AllowShortBlocksOnASingleLine: Never + AllowShortIfStatementsOnASingleLine: Never Enforces line break after if. So allowed formattings are now:
if (someTest)
  foo();

and

if (someTest) {
  foo();
}

Again this is now identical to ALICE. Changes we discussed to always add the brackets isn't possible with our version of clang-format.

  • Not discussed during the meeting:
  - Regex:          '".*"'
    Priority:        1

This should only affect online code. Puts includes from within cbmroot (included via "") before external includes (that should be included via <>). This is necessary because online code drops the Cbm prefix from file names that is used to distinguish cbmroot headers.

  • SpaceBeforeCpp11BracedList: false: ALICE styleguide recommends using brace initialization.
std::vector<std::string> myVector {"alpha", "beta", "gamma"};
// becomes
std::vector<std::string> myVector{"alpha", "beta", "gamma"};

This unifies initialization for c structs and c++ classes.

Requesting feedback from: @p.-a.loizeau, @d.smith, @j.decuveland, @s.zharko, @se.gorbunov, @f.uhlig, @v.friese

Edited by Felix Weiglhofer

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Felix Weiglhofer changed title from dosc: Add styleguide. to docs: Add styleguide.

    changed title from dosc: Add styleguide. to docs: Add styleguide.

  • Felix Weiglhofer changed the description

    changed the description

  • Felix Weiglhofer added 33 commits

    added 33 commits

    Compare with previous version

  • Author Maintainer

    @v.friese: Can we merge? Immediate concerns about if formatting should be addressed with the change to WithoutElse option and we can revisit once we have the new clang-format. And we will never address all formatting issues in a single MR.

    Edited by Felix Weiglhofer
  • Volker Friese resolved all threads

    resolved all threads

  • Volker Friese enabled an automatic merge when the pipeline for d2567e1f succeeds

    enabled an automatic merge when the pipeline for d2567e1f succeeds

  • merged

  • Volker Friese mentioned in merge request !1525 (merged)

    mentioned in merge request !1525 (merged)

  • Please register or sign in to reply
    Loading