|
| 1 | +--- |
| 2 | +# RIT Launch Initiative FSW clang-tidy configuration |
| 3 | +# This configuration enforces the project's coding standards |
| 4 | + |
| 5 | +Checks: > |
| 6 | + -*, |
| 7 | + bugprone-*, |
| 8 | + clang-analyzer-*, |
| 9 | + cppcoreguidelines-*, |
| 10 | + modernize-*, |
| 11 | + performance-*, |
| 12 | + portability-*, |
| 13 | + -portability-avoid-pragma-once, |
| 14 | + readability-*, |
| 15 | + -modernize-use-trailing-return-type, |
| 16 | + -readability-identifier-length, |
| 17 | + -cppcoreguidelines-avoid-magic-numbers, |
| 18 | + -readability-magic-numbers, |
| 19 | + -cppcoreguidelines-pro-bounds-pointer-arithmetic, |
| 20 | + -cppcoreguidelines-pro-bounds-constant-array-index, |
| 21 | + -cppcoreguidelines-pro-type-vararg, |
| 22 | + -cppcoreguidelines-avoid-c-arrays, |
| 23 | + -modernize-avoid-c-arrays, |
| 24 | + -readability-avoid-const-params-in-decls, |
| 25 | + -cppcoreguidelines-owning-memory, |
| 26 | + -cppcoreguidelines-no-malloc, |
| 27 | + -cppcoreguidelines-pro-type-reinterpret-cast, |
| 28 | + -cppcoreguidelines-init-variables, |
| 29 | + -cppcoreguidelines-avoid-non-const-global-variables, |
| 30 | + -modernize-use-auto, |
| 31 | + -readability-implicit-bool-conversion, |
| 32 | + -cppcoreguidelines-pro-type-union-access, |
| 33 | + -readability-braces-around-statements, |
| 34 | + -readability-else-after-return |
| 35 | +
|
| 36 | +WarningsAsErrors: '' |
| 37 | + |
| 38 | +HeaderFilterRegex: '.*' |
| 39 | + |
| 40 | +CheckOptions: |
| 41 | + # Naming conventions |
| 42 | + # Classes must start with 'C' |
| 43 | + - key: readability-identifier-naming.ClassCase |
| 44 | + value: CamelCase |
| 45 | + - key: readability-identifier-naming.ClassPrefix |
| 46 | + value: 'C' |
| 47 | + |
| 48 | + # Structs must start with 'C' (treated like classes in C++) |
| 49 | + - key: readability-identifier-naming.StructCase |
| 50 | + value: CamelCase |
| 51 | + - key: readability-identifier-naming.StructPrefix |
| 52 | + value: 'C' |
| 53 | + |
| 54 | + # Namespaces must start with 'N' |
| 55 | + - key: readability-identifier-naming.NamespaceCase |
| 56 | + value: CamelCase |
| 57 | + - key: readability-identifier-naming.NamespacePrefix |
| 58 | + value: 'N' |
| 59 | + |
| 60 | + # Public member functions: CamelCase with capitalized first letter |
| 61 | + - key: readability-identifier-naming.PublicMethodCase |
| 62 | + value: CamelCase |
| 63 | + |
| 64 | + # Private member functions: camelBack (first letter lowercase) |
| 65 | + - key: readability-identifier-naming.PrivateMethodCase |
| 66 | + value: camelBack |
| 67 | + |
| 68 | + # Protected member functions: camelBack (first letter lowercase) |
| 69 | + - key: readability-identifier-naming.ProtectedMethodCase |
| 70 | + value: camelBack |
| 71 | + |
| 72 | + # Member variables: camelBack |
| 73 | + - key: readability-identifier-naming.MemberCase |
| 74 | + value: camelBack |
| 75 | + |
| 76 | + # Private member variables: camelBack |
| 77 | + - key: readability-identifier-naming.PrivateMemberCase |
| 78 | + value: camelBack |
| 79 | + |
| 80 | + # Public member variables: camelBack |
| 81 | + - key: readability-identifier-naming.PublicMemberCase |
| 82 | + value: camelBack |
| 83 | + |
| 84 | + # Protected member variables: camelBack |
| 85 | + - key: readability-identifier-naming.ProtectedMemberCase |
| 86 | + value: camelBack |
| 87 | + |
| 88 | + # Parameters: camelBack |
| 89 | + - key: readability-identifier-naming.ParameterCase |
| 90 | + value: camelBack |
| 91 | + |
| 92 | + # Local variables: camelBack |
| 93 | + - key: readability-identifier-naming.LocalVariableCase |
| 94 | + value: camelBack |
| 95 | + |
| 96 | + # Global variables: camelBack |
| 97 | + - key: readability-identifier-naming.GlobalVariableCase |
| 98 | + value: camelBack |
| 99 | + |
| 100 | + # Constants: CamelCase or UPPER_CASE both acceptable |
| 101 | + - key: readability-identifier-naming.ConstantCase |
| 102 | + value: aNy_CasE |
| 103 | + |
| 104 | + # Enums: CamelCase |
| 105 | + - key: readability-identifier-naming.EnumCase |
| 106 | + value: CamelCase |
| 107 | + |
| 108 | + # Enum constants: CamelCase |
| 109 | + - key: readability-identifier-naming.EnumConstantCase |
| 110 | + value: CamelCase |
| 111 | + |
| 112 | + # Template parameters: CamelCase |
| 113 | + - key: readability-identifier-naming.TemplateParameterCase |
| 114 | + value: CamelCase |
| 115 | + |
| 116 | + # Type aliases and typedefs: CamelCase |
| 117 | + - key: readability-identifier-naming.TypedefCase |
| 118 | + value: CamelCase |
| 119 | + - key: readability-identifier-naming.TypeAliasCase |
| 120 | + value: CamelCase |
| 121 | + |
| 122 | + # Functions (C style with underscores is allowed for Zephyr compatibility) |
| 123 | + - key: readability-identifier-naming.FunctionCase |
| 124 | + value: aNy_CasE |
| 125 | + |
| 126 | + # Line length (enforced by clang-format, but mentioned here for completeness) |
| 127 | + # Maximum line length is 120 characters (configured in .clang-format) |
| 128 | + |
| 129 | + # Brace wrapping and indentation |
| 130 | + # 4 space indents - configured in .clang-format |
| 131 | + # Opening braces on same line - configured in .clang-format |
| 132 | + |
| 133 | + # Include sorting |
| 134 | + # Alphabetized includes with grouping - configured in .clang-format |
| 135 | + |
| 136 | + # Readability options |
| 137 | + - key: readability-braces-around-statements.ShortStatementLines |
| 138 | + value: '0' |
| 139 | + - key: readability-function-cognitive-complexity.Threshold |
| 140 | + value: '50' |
| 141 | + - key: readability-function-size.LineThreshold |
| 142 | + value: '200' |
| 143 | + - key: readability-function-size.StatementThreshold |
| 144 | + value: '150' |
| 145 | + |
| 146 | + # Modern C++ features |
| 147 | + - key: modernize-use-nullptr.NullMacros |
| 148 | + value: 'NULL' |
| 149 | + |
| 150 | + # Performance |
| 151 | + - key: performance-move-const-arg.CheckTriviallyCopyableMove |
| 152 | + value: 'true' |
| 153 | + |
| 154 | + # Ignore certain patterns for C functions from Zephyr |
| 155 | + # C functions with underscores (k_*, z_*, etc.) are explicitly allowed |
| 156 | + - key: readability-identifier-naming.FunctionIgnoredRegexp |
| 157 | + value: '^(k_|z_|sys_|device_|gpio_|uart_|spi_|i2c_|LOG_|sntp_|.*_init|.*_setup|.*_handler).*' |
| 158 | + |
| 159 | + # Ignore certain variable patterns for compatibility |
| 160 | + - key: readability-identifier-naming.LocalVariableIgnoredRegexp |
| 161 | + value: '^(k_|z_|sys_|ts|rc|rv|fd)$' |
| 162 | + - key: readability-identifier-naming.ParameterIgnoredRegexp |
| 163 | + value: '^(k_|z_|sys_|_).*' |
| 164 | + |
| 165 | +... |
0 commit comments