-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .clang-tidy and fix clang-tidy warnings (#857)
Adds a .clang-tidy configuration file. This does not add CI tests yet, but I wanted to get it ready to do so without forcing it on anyone. As-is, this PR will enable clang-tidy "yellow squiggles" if you use clangd in vscode. Starting with these Checks: ``` Checks: 'clang-diagnostic-*, clang-analyzer-*, cppcoreguidelines-*, modernize-*, bugprone-*, performance-*, readability-*, llvm-*, -modernize-use-trailing-return-type' ``` Here is a list of warnings fixed * readability-identifier-length * cppcoreguidelines-special-member-functions * modernize-use-nodiscard * modernize-use-nullptr * cppcoreguidelines-pro-type-cstyle-cast (ignore locally for CUDA-defined stream constants) * performance-noexcept-move-constructor * readability-function-cognitive-complexity * readability-qualified-auto * modernize-concat-nested-namespaces * readability-isolate-declaration * readability-redundant-member-init * modernize-use-override * modernize-avoid-c-arrays * cppcoreguidelines-pro-bounds-array-to-pointer-decay * cppcoreguidelines-pro-bounds-constant-array-index * bugprone-narrowing-conversions * readability-implicit-bool-conversion * readability-redundant-smartptr-get * llvm-else-after-return * readability-uppercase-literal-suffix * readability-braces-around-statements * cppcoreguidelines-avoid-magic-numbers * performance-unnecessary-value-param * bugprone-macro-parentheses * performance-faster-string-find NOLINT lines have been added where fixes are unavailable, such as with necessary pointer arithmetic or `reinterpret_cast` calls. I have a private branch of google test which adds NOLINT lines to suppress warnings caused by gtest's code. I plan to make a PR for this. There are still a couple of outstanding warnings having to do with "easily swappable parameters" (e.g. when a function takes two sizes. Fixing these requires breaking API changes. Alternatively we could suppress them.) Authors: - Mark Harris (https://github.com/harrism) Approvers: - Jake Hemstad (https://github.com/jrhemstad) - Rong Ou (https://github.com/rongou) - GALI PREM SAGAR (https://github.com/galipremsagar) URL: #857
- Loading branch information
Showing
70 changed files
with
2,402 additions
and
2,093 deletions.
There are no files selected for viewing
This file contains 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,67 @@ | ||
--- | ||
Checks: 'clang-diagnostic-*, | ||
clang-analyzer-*, | ||
cppcoreguidelines-*, | ||
modernize-*, | ||
bugprone-*, | ||
performance-*, | ||
readability-*, | ||
llvm-*, | ||
-cppcoreguidelines-macro-usage, | ||
-llvm-header-guard, | ||
-modernize-use-trailing-return-type, | ||
-readability-named-parameter' | ||
WarningsAsErrors: '' | ||
HeaderFilterRegex: '' | ||
AnalyzeTemporaryDtors: false | ||
FormatStyle: none | ||
CheckOptions: | ||
- key: cert-dcl16-c.NewSuffixes | ||
value: 'L;LL;LU;LLU' | ||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField | ||
value: '0' | ||
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons | ||
value: '0' | ||
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors | ||
value: '1' | ||
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic | ||
value: '1' | ||
- key: google-readability-braces-around-statements.ShortStatementLines | ||
value: '1' | ||
- key: google-readability-function-size.StatementThreshold | ||
value: '800' | ||
- key: google-readability-namespace-comments.ShortNamespaceLines | ||
value: '10' | ||
- key: google-readability-namespace-comments.SpacesBeforeComments | ||
value: '2' | ||
- key: llvm-else-after-return.WarnOnConditionVariables | ||
value: '0' | ||
- key: llvm-else-after-return.WarnOnUnfixable | ||
value: '0' | ||
- key: llvm-qualified-auto.AddConstToQualified | ||
value: '0' | ||
- key: modernize-loop-convert.MaxCopySize | ||
value: '16' | ||
- key: modernize-loop-convert.MinConfidence | ||
value: reasonable | ||
- key: modernize-loop-convert.NamingStyle | ||
value: CamelCase | ||
- key: modernize-pass-by-value.IncludeStyle | ||
value: llvm | ||
- key: modernize-replace-auto-ptr.IncludeStyle | ||
value: llvm | ||
- key: modernize-use-nullptr.NullMacros | ||
value: 'NULL' | ||
- key: readability-identifier-length.IgnoredParameterNames | ||
value: 'mr|os' | ||
- key: readability-identifier-length.IgnoredVariableNames | ||
value: 'mr|_' | ||
#- key: readability-function-cognitive-complexity.IgnoreMacros | ||
# value: '1' | ||
- key: bugprone-easily-swappable-parameters.IgnoredParameterNames | ||
value: 'alignment' | ||
- key: cppcoreguidelines-avoid-magic-numbers.IgnorePowersOf2IntegerValues | ||
value: '1' | ||
- key: readability-magic-numbers.IgnorePowersOf2IntegerValues | ||
value: '1' | ||
... |
This file contains 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
This file contains 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.