File: README.clang-tidy

package info (click to toggle)
labplot 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 70,348 kB
  • sloc: cpp: 145,806; ansic: 4,534; python: 881; yacc: 540; xml: 357; sh: 185; awk: 35; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 1,139 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
http://clang.llvm.org/extra/clang-tidy/

To use clang-tidy:
* add -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to cmake (for example in compile-clang)
* cd src && ln -s ../build-clang/compile_commands.json compile_commands.json
* execute clang-tidy


To list all available checks:
* clang-tidy --list-checks -checks='*' | grep "modernize"

E.g., use override for virtual funcsion:
* clang-tidy my_file.cpp -checks='modernize-use-override'

clan-tidy can also execute clang-analyzer checks, e.g.
* clang-tidy my_file.cpp -checks=-*,clang-analyzer-*,-clang-analyzer-cplusplus*

To apply the fixes direcly on the file, add 'fix' parameter:
* clang-tidy.py my_file.cpp -header-filter='.*' -checks='-*,modernize-use-nullptr' -fix

To apply clang-tidy to many files, use the run-clang-tidy.py script in this folder (current version under run-clang-tidy.py -header-filter='.*' -checks='-*,modernize-use-nullptr' -fix), execute in src/:
* python3 ../admin/run-clang-tidy.py backend/ -header-filter='.*' -checks='-*,modernize-use-override' -fix
* python3 ../admin/run-clang-tidy.py backend/ -header-filter='.*' -checks='-*,modernize-use-nullptr' -fix
* etc.