Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the primary aims of #2689 was to facilitate the integration of our codebase with IDEs and other third party tools. This PR adds support for integrating clang-tidy, a linter tool for C++ source files, in our CI workflow. Static analysers are very useful to catch bugs and enforce stricter guidelines than your compiler's default warnings, and clang-tidy is arguably the most used and well-known of all of them.
Now, we cannot enforce any particular set of guidelines in one go, as that would be unfeasible (and probably not a good idea). For this reason, this PR includes the integration of the clang-tidy-review GitHub action, which creates a pull request review based on clang-tidy warnings.
These warnings then, hopefully, will be useful to contributors to improve the quality of their code. Note, however, that these checks won't be a point of failure (I think this is the most reasonable thing to do since our codebase isn't clang-tidy clean).
One important thing to discuss would be: what checks should be included in the warnings? Clang-tidy has an extensive list of available checks and allows defining a custom configuration file (see
.clang-tidy
file in this PR). I have created a starting configuration file, which I think is reasonable, but we should discuss this further (especially on checks that are intended to improve readability).You can run clang-tidy locally on a file as follows:
Also, many IDEs (e.g. Qt Creator) comes with built-in support for clang-tidy or provide an easy way to integrate it.