Skip to content

Commit

Permalink
Don't lint HexValidation on mid-word hex strings
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored and sds committed Sep 28, 2015
1 parent c435e2a commit 0a9f024
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/scss_lint/linter/hex_validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Linter::HexValidation < Linter
def visit_script_string(node)
return unless node.type == :identifier

node.value.scan(/(#\h+)/) do |match|
node.value.scan(/(?:\W|^)(#\h+)(?:\W|$)/) do |match|
check_hex(match.first, node)
end
end
Expand Down
11 changes: 11 additions & 0 deletions spec/scss_lint/linter/hex_validation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,15 @@
it { should report_lint line: 2 }
it { should report_lint line: 3 }
end

context 'when rule contains hex codes in a longer string' do
let(:scss) { <<-SCSS }
p {
content: 'foo#bad';
content: 'foo #ba';
}
SCSS

it { should report_lint line: 3 }
end
end

0 comments on commit 0a9f024

Please sign in to comment.