Skip to content

Commit

Permalink
Merge pull request #266 from iwarapter/feature/issue#265
Browse files Browse the repository at this point in the history
Feature/issue#265
  • Loading branch information
racodond committed May 22, 2016
2 parents 853e5ef + 3a4589e commit 49d7acb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void init() {

@Override
public void visitNode(AstNode node) {
if ("include".equals(node.getTokenValue()) && !node.getFirstChild(PuppetGrammar.FUNCVALUES).getChildren(PuppetPunctuator.COMMA).isEmpty()) {
if ("include".equals(node.getTokenValue()) && node.hasDescendant(PuppetPunctuator.COMMA)) {
addIssue(node, this, "Split this include statement into multiple lines.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class OneIncludePerLineCheckSpec extends Specification {
.next().atLine(2).withMessage(MESSAGE)
.next().atLine(3).withMessage(MESSAGE)
.next().atLine(6).withMessage(MESSAGE)
.next().atLine(8).withMessage(MESSAGE)
.noMore();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
include Class['base::linux']
include Class['base::linux'], Class['base::tomcat'] # Noncompliant

include( "stdlib", "apache" ) # Noncompliant
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ class FunctionSpec extends GrammarSpec {
assertThat(p).matches('include $my_classes')
}
def 'include with brackets'() {
expect:
assertThat(p).matches('include( "stdlib", "apache" )')
}
def "function using hash array accessor"() {
expect:
assertThat(p).matches('dirname($logfiles[1][1])')
}
}
}

0 comments on commit 49d7acb

Please sign in to comment.