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
14
14
Dir . chdir ( @directory ) do
15
15
results . xpath ( '//file' ) . each do |file |
16
16
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
+
18
22
issue = {
19
23
type : "issue" ,
20
- check_name : lint [ "source" ] ,
21
- description : lint [ "message" ] ,
24
+ check_name : lint [ "source" ] . value ,
25
+ description : lint [ "message" ] . value ,
22
26
categories : [ "Style" ] ,
23
27
remediation_points : 500 ,
24
28
location : {
25
29
path : path ,
26
30
positions : {
27
31
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
30
34
} ,
31
35
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
34
38
}
35
39
}
36
40
}
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ module Engine
22
22
expect { lint . run } . to_not output . to_stdout
23
23
end
24
24
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
+
25
31
describe "with exclude_paths" do
26
32
let ( :engine_config ) { { "exclude_paths" => %w( excluded.css ) } }
27
33
You can’t perform that action at this time.
0 commit comments