Skip to content

Commit c01f5ee

Browse files
author
ABaldwinHunter
committed
make room for both sets of tests
1 parent 222c34b commit c01f5ee

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

lib/cc/analyzer/engines_runner.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def include_paths
8080
end
8181

8282
def exclude_paths
83-
@exclude_paths ||= PathPatterns.new(@config.exclude_paths || []).expanded + gitignore_paths
83+
PathPatterns.new(@config.exclude_paths || []).expanded + gitignore_paths
8484
end
8585

8686
def gitignore_paths
@@ -90,7 +90,6 @@ def gitignore_paths
9090
[]
9191
end
9292
end
93-
9493
end
9594
end
9695
end

spec/cc/analyzer/include_paths_builder_spec.rb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ module CC::Analyzer
88
within_temp_dir { test.call }
99
end
1010

11-
let(:builder) { CC::Analyzer::IncludePathsBuilder.new(cc_excludes, []) }
11+
let(:builder) { CC::Analyzer::IncludePathsBuilder.new(cc_excludes, cc_includes) }
1212
let(:cc_excludes) { [] }
13+
let(:cc_includes) { [] }
1314
let(:result) { builder.build }
1415

1516
before do
@@ -221,5 +222,26 @@ module CC::Analyzer
221222
result.include?("subdir/subdir/").must_equal(false)
222223
end
223224
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
224246
end
225247
end

0 commit comments

Comments
 (0)