Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a .clang-tidy to lint the C++ code #648

Merged

Conversation

eloisebrosseau
Copy link
Contributor

Add a .clang-tidy to lint the C++ code

Summarize your change.

A .clang-tidy was added at the root of the project to lint our C++ code. We should do the same for commercial RV if everyone is happy with this one. The formatStyle is set to 'file' so that the changes suggested by the linter will match the rules in our .clang-format. WarningAsErrors could be changed to match all or any of the checks if, at one point, we would want to enforce the respect of a category. HeaderFilterRegex could be changed if we need to exclude some header files from being lint by clang-tidy.

Describe the reason for the change.

Just like we are formatting our code with the .clang-format, we should also lint it using a .clang-tidy. This is the one I've been using personally but I think it could be beneficial to others, especially for code reviews since it would help to avoid having to ask for small changes that could have been easily catch by a linter. Ideally, we would also add it to our CI pipeline so that we don't only rely on people generating a compile_commands.json to use it and making the changes suggested to the code by the linter. Here's the documentation

If possible, provide screenshots.

Here's an example of what the linter messages could look like:

Screenshot 2024-12-04 at 3 42 17 PM

Copy link
Contributor

@bernie-laberge bernie-laberge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thank you @eloisebrosseau !

Signed-off-by: Éloïse Brosseau <[email protected]>
@eloisebrosseau eloisebrosseau enabled auto-merge (squash) December 13, 2024 15:03
@eloisebrosseau eloisebrosseau merged commit b040a0c into AcademySoftwareFoundation:main Dec 13, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants