File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def include_paths
80
80
end
81
81
82
82
def exclude_paths
83
- @exclude_paths ||= PathPatterns . new ( @config . exclude_paths || [ ] ) . expanded + gitignore_paths
83
+ PathPatterns . new ( @config . exclude_paths || [ ] ) . expanded + gitignore_paths
84
84
end
85
85
86
86
def gitignore_paths
@@ -90,7 +90,6 @@ def gitignore_paths
90
90
[ ]
91
91
end
92
92
end
93
-
94
93
end
95
94
end
96
95
end
Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ module CC::Analyzer
8
8
within_temp_dir { test . call }
9
9
end
10
10
11
- let ( :builder ) { CC ::Analyzer ::IncludePathsBuilder . new ( cc_excludes , [ ] ) }
11
+ let ( :builder ) { CC ::Analyzer ::IncludePathsBuilder . new ( cc_excludes , cc_includes ) }
12
12
let ( :cc_excludes ) { [ ] }
13
+ let ( :cc_includes ) { [ ] }
13
14
let ( :result ) { builder . build }
14
15
15
16
before do
@@ -221,5 +222,26 @@ module CC::Analyzer
221
222
result . include? ( "subdir/subdir/" ) . must_equal ( false )
222
223
end
223
224
end
225
+
226
+ describe "when cc_include_paths are passed in addition to excludes" do
227
+ let ( :cc_excludes ) { [ "untrackable.rb" ] }
228
+ let ( :cc_includes ) { [ "untrackable.rb" , "subdir" ] }
229
+
230
+ before do
231
+ make_file ( "untrackable.rb" )
232
+ make_file ( "trackable.rb" )
233
+ make_file ( "subdir/subdir_trackable.rb" )
234
+ make_file ( "subdir/foo.rb" )
235
+ make_file ( "subdir/baz.rb" )
236
+ end
237
+
238
+ it "includes requested paths" do
239
+ result . include? ( "subdir/" ) . must_equal ( true )
240
+ end
241
+
242
+ it "omits requested paths that are excluded by .codeclimate.yml" do
243
+ result . include? ( "untrackable.rb" ) . must_equal ( false )
244
+ end
245
+ end
224
246
end
225
247
end
You can’t perform that action at this time.
0 commit comments