|
| 1 | +# ============================================================ |
| 2 | +# mcpp-community clang-tidy configuration |
| 3 | +# |
| 4 | +# Defines the static analysis rules used by mcpp-community |
| 5 | +# projects to enforce correctness, performance, and portability. |
| 6 | +# |
| 7 | +# Repository: |
| 8 | +# https://github.com/mcpp-community/mcpp-style-ref |
| 9 | +# |
| 10 | +# Strategy: |
| 11 | +# - Whitelist-based rule selection |
| 12 | +# - Enable high-value static analysis checks |
| 13 | +# - Avoid overly opinionated style rules |
| 14 | +# |
| 15 | +# Target: |
| 16 | +# Modern C++ projects (C++23 and above) |
| 17 | +# Generic libraries (STL-like containers, algorithms, utilities) |
| 18 | +# ============================================================ |
| 19 | + |
| 20 | + |
| 21 | +Checks: |
| 22 | + |
| 23 | + # ------------------------------------------------------------ |
| 24 | + # Disable all checks (whitelist mode) |
| 25 | + # ------------------------------------------------------------ |
| 26 | + -* |
| 27 | + |
| 28 | + |
| 29 | + # ------------------------------------------------------------ |
| 30 | + # Compiler diagnostics |
| 31 | + # Forward compiler warnings into clang-tidy |
| 32 | + # ------------------------------------------------------------ |
| 33 | + clang-diagnostic-* |
| 34 | + |
| 35 | + |
| 36 | + # ------------------------------------------------------------ |
| 37 | + # Clang static analyzer |
| 38 | + # Advanced static analysis (memory, null, logic) |
| 39 | + # ------------------------------------------------------------ |
| 40 | + clang-analyzer-* |
| 41 | + |
| 42 | + |
| 43 | + # ------------------------------------------------------------ |
| 44 | + # Bug-prone patterns |
| 45 | + # Detect common programming mistakes |
| 46 | + # ------------------------------------------------------------ |
| 47 | + bugprone-* |
| 48 | + |
| 49 | + |
| 50 | + # ------------------------------------------------------------ |
| 51 | + # Performance improvements |
| 52 | + # Detect inefficient code patterns |
| 53 | + # ------------------------------------------------------------ |
| 54 | + performance-* |
| 55 | + |
| 56 | + |
| 57 | + # ------------------------------------------------------------ |
| 58 | + # Modern C++ improvements |
| 59 | + # Suggest modern C++ constructs |
| 60 | + # ------------------------------------------------------------ |
| 61 | + modernize-* |
| 62 | + |
| 63 | + |
| 64 | + # ------------------------------------------------------------ |
| 65 | + # Miscellaneous useful checks |
| 66 | + # Various useful static checks |
| 67 | + # ------------------------------------------------------------ |
| 68 | + misc-* |
| 69 | + |
| 70 | + |
| 71 | + # ------------------------------------------------------------ |
| 72 | + # Portability checks |
| 73 | + # Detect cross-platform issues |
| 74 | + # ------------------------------------------------------------ |
| 75 | + portability-* |
| 76 | + |
| 77 | + |
| 78 | + # ------------------------------------------------------------ |
| 79 | + # Selected readability checks |
| 80 | + # ------------------------------------------------------------ |
| 81 | + |
| 82 | + # Require braces for control statements |
| 83 | + readability-braces-around-statements |
| 84 | + |
| 85 | + # Avoid implicit bool conversions |
| 86 | + readability-implicit-bool-conversion |
| 87 | + |
| 88 | + # Simplify boolean expressions |
| 89 | + readability-simplify-boolean-expr |
| 90 | + |
| 91 | + # Encourage qualified auto usage |
| 92 | + readability-qualified-auto |
| 93 | + |
| 94 | + |
| 95 | + # ------------------------------------------------------------ |
| 96 | + # Disabled modernize checks |
| 97 | + # ------------------------------------------------------------ |
| 98 | + |
| 99 | + # Do not force auto usage |
| 100 | + -modernize-use-auto |
| 101 | + |
| 102 | + # Allow C-style arrays where appropriate |
| 103 | + -modernize-avoid-c-arrays |
| 104 | + |
| 105 | + |
| 106 | + # ------------------------------------------------------------ |
| 107 | + # Disabled readability checks |
| 108 | + # ------------------------------------------------------------ |
| 109 | + |
| 110 | + # Naming handled by project conventions |
| 111 | + -readability-identifier-naming |
| 112 | + |
| 113 | + # Algorithms frequently use literal constants |
| 114 | + -readability-magic-numbers |
| 115 | + |
| 116 | + # Not suitable for template-heavy code |
| 117 | + -readability-function-size |
| 118 | + |
| 119 | + |
| 120 | + # ------------------------------------------------------------ |
| 121 | + # Disabled ecosystem-specific checks |
| 122 | + # ------------------------------------------------------------ |
| 123 | + |
| 124 | + # Fuchsia project specific |
| 125 | + -fuchsia-* |
| 126 | + |
| 127 | + # Zircon kernel specific |
| 128 | + -zircon-* |
| 129 | + |
| 130 | + # Abseil library specific |
| 131 | + -abseil-* |
| 132 | + |
| 133 | + # Android codebase specific |
| 134 | + -android-* |
| 135 | + |
| 136 | + # LLVM coding style specific |
| 137 | + -llvm-* |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | +# ------------------------------------------------------------ |
| 142 | +# General configuration |
| 143 | +# ------------------------------------------------------------ |
| 144 | + |
| 145 | +WarningsAsErrors: '' |
| 146 | + |
| 147 | +HeaderFilterRegex: '.*' |
| 148 | + |
| 149 | +AnalyzeTemporaryDtors: false |
| 150 | + |
| 151 | +FormatStyle: none |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | +# ------------------------------------------------------------ |
| 156 | +# Check options |
| 157 | +# ------------------------------------------------------------ |
| 158 | + |
| 159 | +CheckOptions: |
| 160 | + |
| 161 | + |
| 162 | + # ------------------------------------------------------------ |
| 163 | + # readability configuration |
| 164 | + # ------------------------------------------------------------ |
| 165 | + |
| 166 | + # Always require braces |
| 167 | + - key: readability-braces-around-statements.ShortStatementLines |
| 168 | + value: '0' |
| 169 | + |
| 170 | + |
| 171 | + # ------------------------------------------------------------ |
| 172 | + # modernize configuration |
| 173 | + # ------------------------------------------------------------ |
| 174 | + |
| 175 | + # Avoid aggressive loop rewriting |
| 176 | + - key: modernize-loop-convert.MinConfidence |
| 177 | + value: reasonable |
| 178 | + |
| 179 | + |
| 180 | + # ------------------------------------------------------------ |
| 181 | + # performance configuration |
| 182 | + # ------------------------------------------------------------ |
| 183 | + |
| 184 | + # No additional allowed types |
| 185 | + - key: performance-unnecessary-value-param.AllowedTypes |
| 186 | + value: '' |
| 187 | + |
| 188 | + |
| 189 | + # ------------------------------------------------------------ |
| 190 | + # misc configuration |
| 191 | + # ------------------------------------------------------------ |
| 192 | + |
| 193 | + # Ignore unused parameters in virtual overrides |
| 194 | + - key: misc-unused-parameters.IgnoreVirtual |
| 195 | + value: 'true' |
0 commit comments