pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.16k stars 366 forks source link

Use clang-tidy #2357

Closed lbartoletti closed 2 years ago

lbartoletti commented 2 years ago

clang-tidy is a useful tool for helping to keep a good code quality. I would suggest looking into the following option classes:

bugprone-
clang-analyzer-
cppcoreguidelines-
modernize-
openmp-
performance-
portability-
readability-

It can give warnings, but with -fix or --fix-errors it can even automatically apply some corrections.

The full list of options is here.

Notably, it also integrates well with IDEs (see here.

From a terminal,

use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON when calling cmake (e.g. add it to the cmake.sh)
use -p=build when calling clang-tidy, so it will know all include directories, defines etc.

Problem No problems, but

Improvement There are warnings and improvements (readability, performance, etc)

Alternatives

lbartoletti commented 2 years ago

[X] Performance: https://github.com/pgRouting/pgrouting/pull/2356