File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed
Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 1+ require "rspec/core/rake_task"
2+
3+ RSpec ::Core ::RakeTask . new ( :spec )
4+
5+ task default : :spec
Original file line number Diff line number Diff line change @@ -14,23 +14,27 @@ def run
1414 Dir . chdir ( @directory ) do
1515 results . xpath ( '//file' ) . each do |file |
1616 path = file [ 'name' ] . sub ( /\A #{ @directory } \/ / , '' )
17- file . xpath ( '//error' ) . each do |lint |
17+ file . children . each do |node |
18+ next unless node . name == "error"
19+
20+ lint = node . attributes
21+
1822 issue = {
1923 type : "issue" ,
20- check_name : lint [ "source" ] ,
21- description : lint [ "message" ] ,
24+ check_name : lint [ "source" ] . value ,
25+ description : lint [ "message" ] . value ,
2226 categories : [ "Style" ] ,
2327 remediation_points : 500 ,
2428 location : {
2529 path : path ,
2630 positions : {
2731 begin : {
28- line : lint [ "line" ] . to_i ,
29- column : lint [ "column" ] . to_i
32+ line : lint [ "line" ] . value . to_i ,
33+ column : lint [ "column" ] . value . to_i
3034 } ,
3135 end : {
32- line : lint [ "line" ] . to_i ,
33- column : lint [ "column" ] . to_i
36+ line : lint [ "line" ] . value . to_i ,
37+ column : lint [ "column" ] . value . to_i
3438 }
3539 }
3640 }
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ module Engine
2222 expect { lint . run } . to_not output . to_stdout
2323 end
2424
25+ it "only reports issues in the file where they're present" do
26+ create_source_file ( 'bad.css' , id_selector_content )
27+ create_source_file ( 'good.css' , '.foo { margin: 0 }' )
28+ expect { lint . run } . not_to output ( /good\. css/ ) . to_stdout
29+ end
30+
2531 describe "with exclude_paths" do
2632 let ( :engine_config ) { { "exclude_paths" => %w( excluded.css ) } }
2733
You can’t perform that action at this time.
0 commit comments