Skip to content

Commit f335866

Browse files
authored
Merge pull request #9 from jiuka/comments
Reset not only whitespaces but comments too.
2 parents e0892d8 + 365127b commit f335866

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/puppet-lint/plugins/check_strict_indent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def check
5757

5858
# reset prev_token to last non-whitespace token on previous line
5959
prev_token = token.prev_token
60-
while not prev_token.nil? and prev_token.type == :WHITESPACE
60+
while not prev_token.nil? and (prev_token.type == :WHITESPACE or prev_token.type == :COMMENT)
6161
prev_token = prev_token.prev_token
6262
end
6363

spec/puppet-lint/plugins/check_strict_indent_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@
4141
end
4242
end
4343

44+
context 'comment after resource title.' do
45+
let(:code) {
46+
<<-EOF.gsub(/^ {8}/, '')
47+
class (
48+
) {
49+
file {
50+
'this': #comment
51+
ensure => 'present',
52+
}
53+
}
54+
EOF
55+
}
56+
57+
it 'should detect 0 problems' do
58+
expect(problems).to have(0).problems
59+
end
60+
end
61+
4462
context 'invalid array indent' do
4563
let(:code) {
4664
<<-EOF.gsub(/^ {8}/, '')

0 commit comments

Comments
 (0)