- User Since
- Mon, Jul 9, 5:24 PM (1 w, 4 d)
Thu, Jul 19
Avoid parsing and reformatting the input literal - just print the original source code.
./tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -clang-tidy-binary ../llvm.rel/bin/clang-tidy -checks="-*,readability-magic-numbers" -j 12 -p ../llvm.rel -j 12 -quiet > /tmp/llvm.magic grep "warning:" /tmp/llvm.magic | cut -d: -f5 | cut -d" " -f2 | sort | uniq -c | sort -rn | head -40
Filter out synthetic integers (such as _LINE_) from the report.
Add a (presently failing) test for not tripping up on LINE through several layers of macro expansion (as in GoogleTest library). This creates a lot of false positives in the unit tests and needs to be fixed.
Small refactoring and documentation update.
Wed, Jul 18
Any plans for fix-its that will add the suggested 'const' qualifiers?
Significant refactoring to address review comments - mainly to reduce duplication and implement in functional style.
I think this requires a separate discussion - do we accept magic values only when they are used directly to initialize a constant of the same type? Or do we allow them generically when they are used to initialize any constant? Or do we only accept several layers of nesting, but not too much?
Tue, Jul 17
florin@helios:~/tools/llvm$ find . -name .clang-format | sort
florin@helios:~/tools/llvm$ cat ./tools/clang/tools/extra/test/.clang-format
Address several review comments. Create alias for cppcoreguidelines-avoid-magic-numbers .
@Eugene.Zelenko thank you for suggesting the alias - I didn't know it is that easy, but a grep on "alias" led me to the right place.
Sat, Jul 14
Fri, Jul 13
Accept magic values arbitrarily deep in a constant initialization
Wed, Jul 11
Remove extraneous .html. Sorry for not seeing it earlier.
Thank you for your review @Eugene.Zelenko
Update documentation to clean up formatting
Updated examples code and added several references
Tue, Jul 10
Incorporate review comments. Add support for floating point detection.
Mon, Jul 9
Perhaps M_PI wasn't the best example, as its value won't change soon, but other numbers should be defined in relation to constants.