File tree 2 files changed +2
-65
lines changed
2 files changed +2
-65
lines changed Original file line number Diff line number Diff line change @@ -3,32 +3,11 @@ module Engine
3
3
class FileListResolver
4
4
def initialize ( root :, engine_config : { } , config_store :)
5
5
@root = root
6
- @exclude_paths = engine_config [ "exclude_paths" ] || [ ]
7
- @include_paths = engine_config [ "include_paths" ]
6
+ @include_paths = engine_config [ "include_paths" ] || [ "./" ]
8
7
@config_store = config_store
9
8
end
10
9
11
10
def expanded_list
12
- if @include_paths
13
- include_based_files_to_inspect
14
- else
15
- exclude_based_files_to_inspect
16
- end
17
- end
18
-
19
- private
20
-
21
- def exclude_based_files_to_inspect
22
- rubocop_runner . send ( :find_target_files , [ ] ) . reject do |path |
23
- exclude_due_to_config? ( path )
24
- end
25
- end
26
-
27
- def exclude_due_to_config? ( path )
28
- @exclude_paths . include? ( local_path ( path ) )
29
- end
30
-
31
- def include_based_files_to_inspect
32
11
absolute_include_paths . flat_map do |path |
33
12
if Dir . exist? ( path )
34
13
rubocop_runner . send ( :find_target_files , [ path ] )
@@ -38,10 +17,7 @@ def include_based_files_to_inspect
38
17
end . compact
39
18
end
40
19
41
- def local_path ( path )
42
- realpath = Pathname . new ( @root ) . realpath . to_s
43
- path . gsub ( %r{^#{ realpath } /} , '' )
44
- end
20
+ private
45
21
46
22
def absolute_include_paths
47
23
@include_paths . map { |path | Pathname . new ( path ) . realpath . to_s }
Original file line number Diff line number Diff line change @@ -128,45 +128,6 @@ def method
128
128
expect ( includes_check? ( output , "Lint/UselessAssignment" ) ) . to be false
129
129
end
130
130
131
- it "uses exclusions passed in via the config hash" do
132
- create_source_file ( "my_script" , <<-EORUBY )
133
- #!/usr/bin/env ruby
134
-
135
- def method
136
- unused = "x"
137
-
138
- return false
139
- end
140
- EORUBY
141
- config = { "exclude_paths" => [ "my_script" ] }
142
- output = run_engine ( config )
143
-
144
- expect ( includes_check? ( output , "Lint/UselessAssignment" ) ) . to be false
145
- end
146
-
147
- it "layers config exclusions on top of the YAML config" do
148
- create_source_file ( "foo.rb" , <<-EORUBY )
149
- def method
150
- unused = "x"
151
- return false
152
- end
153
- EORUBY
154
- create_source_file ( "bar.rb" , <<-EORUBY )
155
- def method
156
- unused = "x"
157
- return false
158
- end
159
- EORUBY
160
- create_source_file (
161
- "rubocop.yml" ,
162
- "AllCops:\n Exclude:\n - \" foo.rb\" \n "
163
- )
164
- config = { "config" => "rubocop.yml" , "exclude_paths" => [ "bar.rb" ] }
165
- output = run_engine ( config )
166
-
167
- expect ( includes_check? ( output , "Lint/UselessAssignment" ) ) . to be false
168
- end
169
-
170
131
it "handles different locations properly" do
171
132
allow_any_instance_of ( RuboCop ::Cop ::Team ) . to receive ( :inspect_file ) . and_return (
172
133
[
You can’t perform that action at this time.
0 commit comments