Skip to content

Commit

Permalink
Allow control comments to apply to a single line
Browse files Browse the repository at this point in the history
Change-Id: Ic898684f7df847878145c430920f82c0225b72c3
Reviewed-on: http://gerrit.causes.com/44988
Tested-by: jenkins <[email protected]>
Reviewed-by: Shane da Silva <[email protected]>
  • Loading branch information
mbertolacci authored and sds committed Dec 3, 2014
1 parent 8c6ffbc commit 8932449
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/scss_lint/control_comment_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def before_node_visit(node)
return unless linters.include?('all') || linters.include?(@linter.name)

process_command(match[:command], node)

# Is the control comment the only thing on this line?
return if %r{^\s*(//|/\*)}.match(@linter.engine.lines[node.line - 1])

pop_control_comment_stack(node)
end

# Executed after a node has been visited.
Expand Down
12 changes: 12 additions & 0 deletions spec/scss_lint/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,17 @@ def visit_rule(node)

it { should_not report_lint }
end

context 'when the command comment is at the end of a statement' do
let(:css) { <<-CSS }
p {
border: fail1; // scss-lint:disable Fake
border: fail1;
}
CSS

it { should_not report_lint line: 2 }
it { should report_lint line: 3 }
end
end
end

0 comments on commit 8932449

Please sign in to comment.