Skip to content

Commit be99efc

Browse files
ktfsawenzel
authored andcommitted
Align member name check to actual convention
Our conventions states that the `m' prefix only applies to classes, not structs. http://htmlpreview.github.io/?https://github.com/AliceO2Group/CodingGuidelines/blob/master/naming_formatting.html#Variable_names This modifies the checker accordingly.
1 parent 9623372 commit be99efc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

aliceO2/MemberNamesCheck.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ namespace tidy {
2020
namespace aliceO2 {
2121

2222
void MemberNamesCheck::registerMatchers(MatchFinder *Finder) {
23-
Finder->addMatcher(fieldDecl().bind("field_decl1"), this);
23+
// Our policy says that only class members need to start with m, not
24+
// struct members
25+
Finder->addMatcher((fieldDecl(hasParent(recordDecl(isClass())))).bind("field_decl1"), this);
2426
}
2527

2628
void MemberNamesCheck::check(const MatchFinder::MatchResult &Result) {
2729
const auto *MatchedDecl = Result.Nodes.getNodeAs<FieldDecl>("field_decl1");
2830
if (MatchedDecl) {
2931
// check that we are inside the AliceO2 namespace to exlude system stuff
3032
// FIXME: needs to be configurable
31-
if (MatchedDecl->getQualifiedNameAsString().find("AliceO2::") != 0)
33+
// NOTE: AliceO2:: is the old one. We agreed to use o2::
34+
if ((MatchedDecl->getQualifiedNameAsString().find("AliceO2::") != 0)
35+
&& (MatchedDecl->getQualifiedNameAsString().find("o2::") != 0))
3236
return;
3337

3438
if (std::regex_match(MatchedDecl->getNameAsString(), Regex)) {

0 commit comments

Comments
 (0)