forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 119
clang-tidy #1580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
JohnsterID
wants to merge
2
commits into
TheSuperHackers:main
from
JohnsterID:build/add-clang-tidy-support
Closed
clang-tidy #1580
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| # TheSuperHackers @build JohnsterID 15/09/2025 Add clang-tidy configuration for code quality analysis | ||
| --- | ||
| # Clang-tidy configuration for GeneralsGameCode project | ||
| # This configuration is tailored for a legacy C++98/C++20 hybrid codebase | ||
| # with Windows-specific code and COM interfaces | ||
|
|
||
| # Enable specific checks that are appropriate for this codebase | ||
| Checks: > | ||
| -*, | ||
| bugprone-*, | ||
| -bugprone-easily-swappable-parameters, | ||
| -bugprone-implicit-widening-of-multiplication-result, | ||
| -bugprone-narrowing-conversions, | ||
| -bugprone-signed-char-misuse, | ||
| cert-*, | ||
| -cert-dcl21-cpp, | ||
| -cert-dcl50-cpp, | ||
| -cert-dcl58-cpp, | ||
| -cert-env33-c, | ||
| -cert-err58-cpp, | ||
| clang-analyzer-*, | ||
| -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, | ||
| cppcoreguidelines-*, | ||
| -cppcoreguidelines-avoid-c-arrays, | ||
| -cppcoreguidelines-avoid-magic-numbers, | ||
| -cppcoreguidelines-avoid-non-const-global-variables, | ||
| -cppcoreguidelines-init-variables, | ||
| -cppcoreguidelines-macro-usage, | ||
| -cppcoreguidelines-no-malloc, | ||
| -cppcoreguidelines-owning-memory, | ||
| -cppcoreguidelines-pro-bounds-array-to-pointer-decay, | ||
| -cppcoreguidelines-pro-bounds-constant-array-index, | ||
| -cppcoreguidelines-pro-bounds-pointer-arithmetic, | ||
| -cppcoreguidelines-pro-type-cstyle-cast, | ||
| -cppcoreguidelines-pro-type-reinterpret-cast, | ||
| -cppcoreguidelines-pro-type-union-access, | ||
| -cppcoreguidelines-pro-type-vararg, | ||
| -cppcoreguidelines-special-member-functions, | ||
| google-*, | ||
| -google-build-using-namespace, | ||
| -google-explicit-constructor, | ||
| -google-readability-casting, | ||
| -google-readability-todo, | ||
| -google-runtime-int, | ||
| -google-runtime-references, | ||
| hicpp-*, | ||
| -hicpp-avoid-c-arrays, | ||
| -hicpp-explicit-conversions, | ||
| -hicpp-no-array-decay, | ||
| -hicpp-signed-bitwise, | ||
| -hicpp-special-member-functions, | ||
| -hicpp-uppercase-literal-suffix, | ||
| -hicpp-use-auto, | ||
| -hicpp-vararg, | ||
| misc-*, | ||
| -misc-const-correctness, | ||
| -misc-include-cleaner, | ||
| -misc-non-private-member-variables-in-classes, | ||
| -misc-use-anonymous-namespace, | ||
| modernize-*, | ||
| -modernize-avoid-c-arrays, | ||
| -modernize-concat-nested-namespaces, | ||
| -modernize-loop-convert, | ||
| -modernize-pass-by-value, | ||
| -modernize-raw-string-literal, | ||
| -modernize-return-braced-init-list, | ||
| -modernize-use-auto, | ||
| -modernize-use-default-member-init, | ||
| -modernize-use-nodiscard, | ||
| -modernize-use-trailing-return-type, | ||
| performance-*, | ||
| -performance-avoid-endl, | ||
| portability-*, | ||
| readability-*, | ||
| -readability-avoid-const-params-in-decls, | ||
| -readability-braces-around-statements, | ||
| -readability-convert-member-functions-to-static, | ||
| -readability-function-cognitive-complexity, | ||
| -readability-identifier-length, | ||
| -readability-implicit-bool-conversion, | ||
| -readability-isolate-declaration, | ||
| -readability-magic-numbers, | ||
| -readability-named-parameter, | ||
| -readability-redundant-access-specifiers, | ||
| -readability-uppercase-literal-suffix | ||
| # Treat warnings as errors for CI/CD | ||
| WarningsAsErrors: false | ||
|
|
||
| # Header filter to include project headers | ||
| HeaderFilterRegex: '(Core|Generals|GeneralsMD|Dependencies)/.*\.(h|hpp)$' | ||
|
|
||
| # Analysis options | ||
| AnalyzeTemporaryDtors: false | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LLVM 19 I have installed locally does not like this option, I suspect older versions from stable Linux OS distributions will like it even less? |
||
|
|
||
| # Check options for specific rules | ||
| CheckOptions: | ||
| # Naming conventions - adapted for the existing codebase style | ||
| - key: readability-identifier-naming.ClassCase | ||
| value: CamelCase | ||
| - key: readability-identifier-naming.StructCase | ||
| value: CamelCase | ||
| - key: readability-identifier-naming.FunctionCase | ||
| value: CamelCase | ||
| - key: readability-identifier-naming.MethodCase | ||
| value: CamelCase | ||
| - key: readability-identifier-naming.VariableCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.ParameterCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.MemberCase | ||
| value: lower_case | ||
| - key: readability-identifier-naming.MemberPrefix | ||
| value: m_ | ||
| - key: readability-identifier-naming.ConstantCase | ||
| value: UPPER_CASE | ||
| - key: readability-identifier-naming.EnumConstantCase | ||
| value: UPPER_CASE | ||
| - key: readability-identifier-naming.MacroDefinitionCase | ||
| value: UPPER_CASE | ||
|
|
||
| # Performance settings | ||
| - key: performance-for-range-copy.WarnOnAllAutoCopies | ||
| value: true | ||
| - key: performance-unnecessary-value-param.AllowedTypes | ||
| value: 'AsciiString;UnicodeString;Utf8String;Utf16String' | ||
|
|
||
| # Modernize settings - be conservative for legacy code | ||
| - key: modernize-use-nullptr.NullMacros | ||
| value: 'NULL' | ||
| - key: modernize-replace-auto-ptr.IncludeStyle | ||
| value: llvm | ||
|
|
||
| # Readability settings | ||
| - key: readability-function-size.LineThreshold | ||
| value: 150 | ||
| - key: readability-function-size.StatementThreshold | ||
| value: 100 | ||
| - key: readability-function-size.BranchThreshold | ||
| value: 25 | ||
| - key: readability-function-size.ParameterThreshold | ||
| value: 8 | ||
| - key: readability-function-size.NestingThreshold | ||
| value: 6 | ||
|
|
||
| # Bugprone settings | ||
| - key: bugprone-argument-comment.StrictMode | ||
| value: false | ||
| - key: bugprone-suspicious-string-compare.WarnOnImplicitComparison | ||
| value: true | ||
| - key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison | ||
| value: true | ||
|
|
||
| # Google style settings | ||
| - key: google-readability-braces-around-statements.ShortStatementLines | ||
| value: 2 | ||
| - key: google-readability-function-size.StatementThreshold | ||
| value: 100 | ||
|
|
||
| # CERT settings | ||
| - key: cert-dcl16-c.NewSuffixes | ||
| value: 'L;LL;LU;LLU' | ||
| - key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||
| value: false | ||
|
|
||
| # Use .clang-format for formatting suggestions | ||
| FormatStyle: file | ||
|
|
||
| # Exclude certain directories and files | ||
| # Note: This is handled by HeaderFilterRegex above, but can be extended | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.