tango-controls / cppTango

Moved to gitlab
http://tango-controls.org
41 stars 34 forks source link

Add CI job with clang tidy #805

Closed t-b closed 2 years ago

t-b commented 4 years ago

This can already be done locally

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=true ..
clang-tidy $(find ../cppapi -iname "*.cpp")

which gives warnings.zip

and manually filtered

$grep "warning:" warnings.log | grep -oP "\[clang.*\]" | sort | uniq -c
     18 [clang-analyzer-core.CallAndMessage]
     30 [clang-analyzer-core.NonNullParamChecker]
     71 [clang-analyzer-core.NullDereference]
      8 [clang-analyzer-core.UndefinedBinaryOperatorResult]
      4 [clang-analyzer-core.uninitialized.Assign]
     12 [clang-analyzer-core.uninitialized.UndefReturn]
      2 [clang-analyzer-cplusplus.NewDelete]
      2 [clang-analyzer-cplusplus.NewDeleteLeaks]
     26 [clang-analyzer-deadcode.DeadStores]
     22 [clang-analyzer-optin.cplusplus.VirtualCall]
    135 [clang-analyzer-security.insecureAPI.strcpy]
      3 [clang-analyzer-unix.MismatchedDeallocator]
      3 [clang-diagnostic-absolute-value]
      2 [clang-diagnostic-instantiation-after-specialization]
      4 [clang-diagnostic-string-plus-int]
mliszcz commented 4 years ago

This can already be done locally

Still I think it would be useful to consider:

For instance I remember seeing NullDereference reported multiple times (probably false positive) in omniORB's stringtypes.h and seqTemplatedecls.h when running clang-tidy on our attribute.cpp. I could not get rid of this neither with -line-filter nor with -header-filter.