.clang-format 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. # Based on the Google C++ Style Guide, with user-specific overrides.
  3. BasedOnStyle: Google
  4. # --- User Overrides from Uncrustify Config ---
  5. # 1. Indentation
  6. # Google Style default is 2, but we keep the explicit setting just in case.
  7. # Uncrustify: indent_columns=2
  8. IndentWidth: 2
  9. # 2. Tabs
  10. # Google Style default is Never, but explicitly set here.
  11. # Uncrustify: indent_with_tabs=0
  12. UseTab: Never
  13. # 3. Column Width
  14. # Uncrustify: code_width=80
  15. ColumnLimit: 80
  16. # 4. Brace Wrapping
  17. # The Google Style default is already to attach braces to the line end
  18. # (e.g., `if (x) { ... }`).
  19. # Uncrustify: nl_class_brace=remove, nl_fdef_brace=remove
  20. # We keep the default: BreakBeforeBraces: Attach
  21. # 5. Assignment Alignment
  22. # This is a key deviation from the Google default, which is usually 'None'.
  23. # Uncrustify: indent_align_assign=true
  24. AlignConsecutiveAssignments: true
  25. # 6. Function Parameter Packing (Google default is to pack)
  26. # Uncrustify: nl_func_def_args=add (Suggests placing each arg on a new line)
  27. BinPackArguments: false
  28. BinPackParameters: false # Applies to declarations
  29. # 7. Pointer Alignment
  30. # Google Style prefers the star next to the type ('int* foo').
  31. # Uncrustify: sp_before_ptr_star=add (e.g. 'int * a;')
  32. # We stick to the Google default: PointerAlignment: Left (or None, which often results in Left).
  33. PointerAlignment: Left
  34. # 8. Namespace Indentation
  35. # Google Style default is false, matching:
  36. # Uncrustify: indent_namespace=false
  37. IndentNamespace: false
  38. # 9. Case Label Indentation
  39. # Google Style default is to indent `case` labels.
  40. # Uncrustify: indent_switch_case=2 (Suggests indenting case labels)
  41. IndentCaseLabels: true
  42. # 10. Operator Alignment
  43. # Uncrustify: align_left_shift=true
  44. AlignOperands: Align
  45. # 11. Newlines/Block Handling
  46. # Uncrustify: mod_full_brace_if=add, mod_full_brace_for=add, etc.
  47. # These are generally handled by Google's requirement for braces, even for single statements.
  48. AllowShortBlocksOnASingleLine: Never
  49. AllowShortIfStatementsOnASingleLine: Never
  50. AllowShortCaseLabelsOnASingleLine: Never
  51. AllowShortFunctionsOnASingleLine: Empty
  52. ...