-
Notifications
You must be signed in to change notification settings - Fork 221
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
clang-tidy: enforce identifier naming and enable rule for classes. #977
base: master
Are you sure you want to change the base?
Conversation
It would be good to add comments to the code that indicate why we need to add these exclusion regexps. For example, why do we need to exclude names starting/ending with underscores? |
7daf473
to
eb0fcdb
Compare
Makes sense. I added explanations for all ignored expressions. Also tweaked some expressions:
|
LGTM now. AFAICS the PR also enables the check (which was previously disabled), right? |
Yes, it also enables the check. Maybe it is a good idea (like we did with |
a5047c7
to
79d5e51
Compare
79d5e51
to
0e5917b
Compare
0e5917b
to
c10419e
Compare
Changed the scope of the PR and enabled the check for class-naming only (+ required changes in the code). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need deprecations and aliases?
@avdgrinten Good point. Most of the current changes concern private structs. Any advise whether they should also be deprecated? |
@@ -35,7 +35,7 @@ struct AttributizedEdge { | |||
} | |||
}; | |||
|
|||
struct greater { | |||
struct Greater { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere? If not it can be removed.
Private structs don't need to be deprecated I think. |
During #940 (unifying naming scheme of enums) it became clear, that currently clang-tidy does not enforce the already defined naming conventions. It is not straightforward however how to activate them. There are currently some established practices in NetworKit, which would lead to mixed naming schemes (for example
G
orG([a-z]*|[0-9]*)
as a name for graph-datastructure variables).The PR includes a first version of a modified clang-tidy file using regular expressions for ignoring some "special" cases of NetworKit. The remaining changes will nevertheless be quite huge anyway, since it includes changes in the API for both C++ and Python. I am not sure, whether this special treatment is the best approach though - so this PR is a starting point to ignite a discussion about how to proceed.