.clang-format 1.2 KB

1234567891011121314151617181920212223242526272829
  1. # Describes the style the codebase ALREADY uses, so running it is close to a
  2. # no-op on existing files. Derived by measuring: 4-space indent, no tabs,
  3. # references bound to the type, attached braces, and a 100-column line (the
  4. # 99th percentile of existing lines is exactly 100).
  5. Language: Cpp
  6. BasedOnStyle: LLVM
  7. IndentWidth: 4
  8. TabWidth: 4
  9. UseTab: Never
  10. ColumnLimit: 100
  11. PointerAlignment: Left
  12. ReferenceAlignment: Left
  13. AccessModifierOffset: -2
  14. AllowShortFunctionsOnASingleLine: Inline
  15. AllowShortIfStatementsOnASingleLine: WithoutElse
  16. AllowShortLoopsOnASingleLine: true
  17. BreakBeforeBraces: Attach
  18. # The single most important setting here. Every route handler is a lambda
  19. # passed to svr.Get/Post/..., and the codebase indents its body 4 from the
  20. # STATEMENT, not from the lambda's column. Without OuterScope, clang-format
  21. # re-indents every handler body in the project.
  22. LambdaBodyIndentation: OuterScope
  23. # The flat quoted-include convention: our own headers are one group and must
  24. # not be re-sorted into the system block.
  25. IncludeBlocks: Preserve
  26. SortIncludes: CaseSensitive
  27. # A braced initialiser holding a JSON object literal is laid out by hand to show
  28. # its shape; letting clang-format repack it destroys the readability.
  29. Cpp11BracedListStyle: true