GeoModel static code checker issues (GeoModelCore / GeoModelIO)
I was wondering what would be the result of running some of the static checkers we use also ATLAS side
I tried to do something "minimal", by the nature of what I did is only the GeoModelCore
/ GeoModelIO
that are checked.
cppcheck
cmake ../GeoModel -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
and then
lsetup cppcheck
cppcheck -j4 --std=c++17 --quiet --enable=warning,portability,performance --inline-suppr -D__CPPCHECK__ -DATOMIC_POINTER_LOCK_FREE=2 --template=gcc --suppress=*:*Boost* --check-level=exhaustive --project=compile_commands.json > cppcheck_log 2>&1 &
clang-tidy
see https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
run-clang-tidy.py -j6 -fix -style=file
with
cat ../.clang-tidy
Checks: '-*,
bugprone-unused-raii,
bugprone-use-after-move,
bugprone-inaccurate-erase,
bugprone-swapped-arguments,
bugprone-string-constructor,
bugprone-stringview-nullptr,
bugprone-suspicious-semicolon,
bugprone-terminating-continue,
bugprone-copy-constructor-init,
bugprone-string-integer-assignment,
bugprone-suspicious-string-compare,
bugprone-move-forwarding-reference,
bugprone-not-null-terminated-result,
bugprone-redundant-branch-condition,
bugprone-bool-pointer-implicit-conversion,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-operator-in-strlen-in-alloc,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-prefer-member-initializer.
google-explicit-constructor
performance-for-range-copy,
performance-move-const-arg,
performance-no-automatic-move,
performance-faster-string-find,
performance-inefficient-algorithm,
performance-trivially-destructible,
performance-unnecessary-value-param,
performance-noexcept-move-constructor,
performance-type-promotion-in-math-fn,
performance-implicit-conversion-in-loop,
performance-inefficient-vector-operation,
performance-unnecessary-copy-initialization,
performance-inefficient-string-concatenation,
readability-qualified-auto,
readability-duplicate-include,
readability-non-const-parameter,
readability-uniqueptr-delete-release,
readability-redundant-access-specifiers,
readability-static-accessed-through-instance,
readability-redundant-function-ptr-dereference,
modernize-make-unique,
modernize-make-shared,
modernize-avoid-bind,
modernize-replace-auto-ptr,
modernize-deprecated-headers,
'
CheckOptions:
- key : cppcoreguidelines-pro-type-member-init.IgnoreArrays
value: 1
Results
The results are under /afs/cern.ch/user/c/christos/public/GeoModel_static_check
I am not sure how much interest is on these, most of the clang_tidy one can easily "auto-fix"
Opinions ping @tsulaia ?
As an aside one could prb get more/different issues from cppcheck if we combine it with other modes of running it