Skip to content

Commit

Permalink
Merge pull request #9 from jiuka/comments
Browse files Browse the repository at this point in the history
Reset not only whitespaces but comments too.
  • Loading branch information
relud authored Jan 7, 2017
2 parents e0892d8 + 365127b commit f335866
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet-lint/plugins/check_strict_indent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check

# reset prev_token to last non-whitespace token on previous line
prev_token = token.prev_token
while not prev_token.nil? and prev_token.type == :WHITESPACE
while not prev_token.nil? and (prev_token.type == :WHITESPACE or prev_token.type == :COMMENT)
prev_token = prev_token.prev_token
end

Expand Down
18 changes: 18 additions & 0 deletions spec/puppet-lint/plugins/check_strict_indent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@
end
end

context 'comment after resource title.' do
let(:code) {
<<-EOF.gsub(/^ {8}/, '')
class (
) {
file {
'this': #comment
ensure => 'present',
}
}
EOF
}

it 'should detect 0 problems' do
expect(problems).to have(0).problems
end
end

context 'invalid array indent' do
let(:code) {
<<-EOF.gsub(/^ {8}/, '')
Expand Down

0 comments on commit f335866

Please sign in to comment.