Code checks
CMSSW can run code checks via clang-tidy in scram. The default list is here: https://github.com/cms-sw/cmssw/blob/master/.clang-tidy
I added a few more: cppcoreguidelines-pro-type-member-init, modernize-loop-convert
and then ran over TreeMaker source code as follows:
touch TreeMakerCode.txt
find TreeMaker/ -name "*.h" >> TreeMakerCode.txt
find TreeMaker/ -name "*.cc" >> TreeMakerCode.txt
env USER_CODE_CHECKS_FILE=TreeMakerCode.txt scram b code-checks
The code is automatically updated to conform to the specified code checks.
A few caveats about modernize-loop-convert
:
- doesn't always use
const
where it could - sometimes chooses unclear names for loop variables
- doesn't seem to recognize range-based loops for
edm::View
types
I dealt with these few issues by hand.