Skip to content

Commit

Permalink
Don't check forward declarations in enum and class naming rules
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrdz committed Oct 3, 2015
1 parent 75dba93 commit cf39fc5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Rules/ClassNamingRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ void ClassNamingRule::RegisterASTMatcherCallback(MatchFinder& finder)
finder.addMatcher(
recordDecl(unless(anyOf(isExpansionInSystemHeader(),
isImplicit(),
isLambda())))
isLambda())),
isDefinition())
.bind("recordDecl"),
this);
}
Expand Down
3 changes: 2 additions & 1 deletion Rules/EnumNamingRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ void EnumNamingRule::RegisterASTMatcherCallback(MatchFinder& finder)
{
finder.addMatcher(
enumDecl(unless(anyOf(isExpansionInSystemHeader(),
isImplicit())))
isImplicit())),
isDefinition())
.bind("enumDecl"),
this);

Expand Down
7 changes: 7 additions & 0 deletions Tests/class_naming_rule_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,10 @@ def test_ignore_lambdas(self):
'}'
],
expected_errors = [])

def test_ignore_forward_declaration(self):
self.assert_colobot_lint_result(
source_file_lines = [
'struct ignore_this;'
],
expected_errors = [])
7 changes: 7 additions & 0 deletions Tests/enum_naming_rule_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,10 @@ def test_inform_about_anonymous_enum(self):
'line': '3'
}
])

def test_ignore_forward_declaration(self):
self.assert_colobot_lint_result(
source_file_lines = [
'enum class ignore_this : int;'
],
expected_errors = [])

0 comments on commit cf39fc5

Please sign in to comment.