rubocop 0.27.1 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubocop might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -4
- data/Gemfile +1 -1
- data/README.md +16 -1
- data/config/default.yml +15 -1
- data/config/disabled.yml +5 -0
- data/config/enabled.yml +10 -2
- data/lib/rubocop.rb +3 -0
- data/lib/rubocop/config.rb +1 -1
- data/lib/rubocop/cop/mixin/access_modifier_node.rb +2 -2
- data/lib/rubocop/cop/mixin/autocorrect_unless_changing_ast.rb +10 -26
- data/lib/rubocop/cop/mixin/on_method_def.rb +1 -1
- data/lib/rubocop/cop/mixin/string_help.rb +10 -1
- data/lib/rubocop/cop/style/align_hash.rb +2 -2
- data/lib/rubocop/cop/style/ascii_identifiers.rb +1 -1
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +21 -19
- data/lib/rubocop/cop/style/else_alignment.rb +29 -16
- data/lib/rubocop/cop/style/empty_else.rb +47 -0
- data/lib/rubocop/cop/style/empty_lines_around_block_body.rb +38 -0
- data/lib/rubocop/cop/style/extra_spacing.rb +35 -0
- data/lib/rubocop/cop/style/indentation_width.rb +1 -1
- data/lib/rubocop/cop/style/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/style/line_end_concatenation.rb +5 -1
- data/lib/rubocop/cop/style/multiline_operation_indentation.rb +20 -4
- data/lib/rubocop/cop/style/negated_while.rb +3 -1
- data/lib/rubocop/cop/style/perl_backrefs.rb +8 -3
- data/lib/rubocop/cop/style/single_line_block_params.rb +7 -1
- data/lib/rubocop/cop/style/special_global_vars.rb +8 -3
- data/lib/rubocop/cop/style/string_literals.rb +4 -11
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +2 -7
- data/lib/rubocop/cop/style/symbol_proc.rb +14 -6
- data/lib/rubocop/cop/style/unneeded_capital_w.rb +2 -1
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cop/variable_force.rb +3 -3
- data/lib/rubocop/cop/variable_force/scope.rb +1 -1
- data/lib/rubocop/cop/variable_force/variable.rb +1 -1
- data/lib/rubocop/formatter/html_formatter.rb +1 -1
- data/lib/rubocop/options.rb +13 -6
- data/lib/rubocop/rake_task.rb +0 -1
- data/lib/rubocop/runner.rb +19 -6
- data/lib/rubocop/target_finder.rb +32 -1
- data/lib/rubocop/version.rb +1 -1
- data/relnotes/v0.28.0.md +90 -0
- data/spec/project_spec.rb +1 -0
- data/spec/rubocop/cli_spec.rb +115 -24
- data/spec/rubocop/comment_config_spec.rb +1 -1
- data/spec/rubocop/cop/lint/assignment_in_condition_spec.rb +0 -1
- data/spec/rubocop/cop/lint/block_alignment_spec.rb +4 -4
- data/spec/rubocop/cop/lint/unused_method_argument_spec.rb +1 -1
- data/spec/rubocop/cop/lint/useless_assignment_spec.rb +2 -3
- data/spec/rubocop/cop/lint/useless_setter_call_spec.rb +1 -1
- data/spec/rubocop/cop/lint/void_spec.rb +0 -1
- data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +2 -2
- data/spec/rubocop/cop/style/blocks_spec.rb +8 -0
- data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +196 -215
- data/spec/rubocop/cop/style/case_indentation_spec.rb +4 -4
- data/spec/rubocop/cop/style/documentation_spec.rb +0 -1
- data/spec/rubocop/cop/style/else_alignment_spec.rb +63 -4
- data/spec/rubocop/cop/style/empty_else_spec.rb +100 -0
- data/spec/rubocop/cop/style/empty_lines_around_block_body_spec.rb +103 -0
- data/spec/rubocop/cop/style/empty_lines_around_method_body_spec.rb +1 -1
- data/spec/rubocop/cop/style/end_of_line_spec.rb +2 -2
- data/spec/rubocop/cop/style/extra_spacing_spec.rb +68 -0
- data/spec/rubocop/cop/style/leading_comment_space_spec.rb +5 -0
- data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +8 -0
- data/spec/rubocop/cop/style/multiline_operation_indentation_spec.rb +35 -2
- data/spec/rubocop/cop/style/negated_if_spec.rb +1 -1
- data/spec/rubocop/cop/style/negated_while_spec.rb +5 -3
- data/spec/rubocop/cop/style/percent_q_literals_spec.rb +1 -1
- data/spec/rubocop/cop/style/perl_backrefs_spec.rb +5 -0
- data/spec/rubocop/cop/style/signal_exception_spec.rb +0 -1
- data/spec/rubocop/cop/style/single_line_block_params_spec.rb +13 -1
- data/spec/rubocop/cop/style/special_global_vars_spec.rb +5 -0
- data/spec/rubocop/cop/style/string_literals_spec.rb +11 -1
- data/spec/rubocop/cop/style/symbol_proc_spec.rb +20 -1
- data/spec/rubocop/cop/style/tab_spec.rb +2 -2
- data/spec/rubocop/cop/style/trailing_comma_spec.rb +1 -1
- data/spec/rubocop/cop/style/unneeded_capital_w_spec.rb +5 -0
- data/spec/rubocop/cop/team_spec.rb +2 -2
- data/spec/rubocop/formatter/offense_count_formatter_spec.rb +0 -1
- data/spec/rubocop/options_spec.rb +2 -0
- data/spec/rubocop/target_finder_spec.rb +23 -2
- metadata +12 -2
@@ -19,6 +19,14 @@ describe RuboCop::Cop::Style::LineEndConcatenation do
|
|
19
19
|
expect(cop.offenses.size).to eq(1)
|
20
20
|
end
|
21
21
|
|
22
|
+
it 'registers an offense for string concat with << and \ at line ends' do
|
23
|
+
inspect_source(cop,
|
24
|
+
['top = "test " \\',
|
25
|
+
'"foo" <<',
|
26
|
+
'"bar"'])
|
27
|
+
expect(cop.offenses.size).to eq(1)
|
28
|
+
end
|
29
|
+
|
22
30
|
it 'registers an offense for dynamic string concat at line end' do
|
23
31
|
inspect_source(cop,
|
24
32
|
['top = "test#{x}" +',
|
@@ -188,6 +188,27 @@ describe RuboCop::Cop::Style::MultilineOperationIndentation do
|
|
188
188
|
expect(cop.config_to_allow_offenses).to eq('EnforcedStyle' => 'indented')
|
189
189
|
end
|
190
190
|
|
191
|
+
it 'registers an offense for misaligned string operand when the first ' \
|
192
|
+
'operand has backslash continuation' do
|
193
|
+
inspect_source(cop,
|
194
|
+
["flash[:error] = 'Here is a string ' \\",
|
195
|
+
" 'That spans' <<",
|
196
|
+
" 'multiple lines'"])
|
197
|
+
expect(cop.messages).to eq(['Align the operands of an expression in an ' \
|
198
|
+
'assignment spanning multiple lines.'])
|
199
|
+
expect(cop.highlights).to eq(["'multiple lines'"])
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'registers an offense for misaligned string operand when plus is used' do
|
203
|
+
inspect_source(cop,
|
204
|
+
["flash[:error] = 'Here is a string ' +",
|
205
|
+
" 'That spans' <<",
|
206
|
+
" 'multiple lines'"])
|
207
|
+
expect(cop.messages).to eq(['Align the operands of an expression in an ' \
|
208
|
+
'assignment spanning multiple lines.'])
|
209
|
+
expect(cop.highlights).to eq(["'multiple lines'"])
|
210
|
+
end
|
211
|
+
|
191
212
|
it 'registers an offense for misaligned operands in unless condition' do
|
192
213
|
inspect_source(cop,
|
193
214
|
['unless a',
|
@@ -198,7 +219,7 @@ describe RuboCop::Cop::Style::MultilineOperationIndentation do
|
|
198
219
|
'`unless` statement spanning multiple ' \
|
199
220
|
'lines.'])
|
200
221
|
expect(cop.highlights).to eq(['.b'])
|
201
|
-
expect(cop.config_to_allow_offenses).to
|
222
|
+
expect(cop.config_to_allow_offenses).to eq('Enabled' => false)
|
202
223
|
end
|
203
224
|
|
204
225
|
it 'registers an offense for misaligned operands in while condition' do
|
@@ -399,7 +420,19 @@ describe RuboCop::Cop::Style::MultilineOperationIndentation do
|
|
399
420
|
expect(cop.messages).to be_empty
|
400
421
|
end
|
401
422
|
|
402
|
-
it 'registers an offense for
|
423
|
+
it 'registers an offense for correct + unrecognized style' do
|
424
|
+
inspect_source(cop,
|
425
|
+
['a ||',
|
426
|
+
' b',
|
427
|
+
'c and',
|
428
|
+
' d'])
|
429
|
+
expect(cop.messages).to eq(['Use 2 (not 4) spaces for indenting an ' \
|
430
|
+
'expression spanning multiple lines.'])
|
431
|
+
expect(cop.highlights).to eq(%w(d))
|
432
|
+
expect(cop.config_to_allow_offenses).to eq('Enabled' => false)
|
433
|
+
end
|
434
|
+
|
435
|
+
it 'registers an offense for aligned operators in assignment' do
|
403
436
|
inspect_source(cop,
|
404
437
|
['formatted_int = int_part',
|
405
438
|
' .abs',
|
@@ -55,7 +55,7 @@ describe RuboCop::Cop::Style::NegatedIf do
|
|
55
55
|
expect(cop.offenses).to be_empty
|
56
56
|
end
|
57
57
|
|
58
|
-
it 'accepts an if where only part of the
|
58
|
+
it 'accepts an if where only part of the condition is negated' do
|
59
59
|
inspect_source(cop,
|
60
60
|
['if !condition && another_condition',
|
61
61
|
' some_method',
|
@@ -38,7 +38,7 @@ describe RuboCop::Cop::Style::NegatedWhile do
|
|
38
38
|
expect(cop.offenses.map(&:line)).to eq([1, 4])
|
39
39
|
end
|
40
40
|
|
41
|
-
it 'accepts an while where only part of the
|
41
|
+
it 'accepts an while where only part of the condition is negated' do
|
42
42
|
inspect_source(cop,
|
43
43
|
['while !a_condition && another_condition',
|
44
44
|
' some_method',
|
@@ -51,8 +51,10 @@ describe RuboCop::Cop::Style::NegatedWhile do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'autocorrects by replacing while not with until' do
|
54
|
-
corrected = autocorrect_source(cop, 'something while !x.even?'
|
55
|
-
|
54
|
+
corrected = autocorrect_source(cop, ['something while !x.even?',
|
55
|
+
'something while(!x.even?)'])
|
56
|
+
expect(corrected).to eq ['something until x.even?',
|
57
|
+
'something until(x.even?)'].join("\n")
|
56
58
|
end
|
57
59
|
|
58
60
|
it 'autocorrects by replacing until not with while' do
|
@@ -63,7 +63,7 @@ describe RuboCop::Cop::Style::PercentQLiterals, :config do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'accepts %q' do
|
66
|
-
# This is most probably a mistake, but not this cop's
|
66
|
+
# This is most probably a mistake, but not this cop's responsibility.
|
67
67
|
inspect_source(cop, ['%q(#{1 + 2})'])
|
68
68
|
expect(cop.offenses).to be_empty
|
69
69
|
end
|
@@ -14,4 +14,9 @@ describe RuboCop::Cop::Style::PerlBackrefs do
|
|
14
14
|
new_source = autocorrect_source(cop, '$1')
|
15
15
|
expect(new_source).to eq('Regexp.last_match[1]')
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'auto-corrects #$1 to #{Regexp.last_match[1]}' do
|
19
|
+
new_source = autocorrect_source(cop, '"#$1"')
|
20
|
+
expect(new_source).to eq('"#{Regexp.last_match[1]}"')
|
21
|
+
end
|
17
22
|
end
|
@@ -11,7 +11,7 @@ describe RuboCop::Cop::Style::SingleLineBlockParams, :config do
|
|
11
11
|
}
|
12
12
|
end
|
13
13
|
|
14
|
-
it '
|
14
|
+
it 'finds wrong argument names in calls with different syntax' do
|
15
15
|
inspect_source(cop,
|
16
16
|
['def m',
|
17
17
|
' [0, 1].reduce { |c, d| c + d }',
|
@@ -42,6 +42,18 @@ describe RuboCop::Cop::Style::SingleLineBlockParams, :config do
|
|
42
42
|
expect(cop.offenses).to be_empty
|
43
43
|
end
|
44
44
|
|
45
|
+
it 'allows an unused parameter to have a leading underscore' do
|
46
|
+
inspect_source(cop,
|
47
|
+
['File.foreach(filename).reduce(0) { |a, _e| a + 1 }'])
|
48
|
+
expect(cop.offenses).to be_empty
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'finds incorrectly named parameters with leading underscores' do
|
52
|
+
inspect_source(cop,
|
53
|
+
['File.foreach(filename).reduce(0) { |_x, _y| }'])
|
54
|
+
expect(cop.messages).to eq(['Name `reduce` block params `|a, e|`.'])
|
55
|
+
end
|
56
|
+
|
45
57
|
it 'ignores do..end blocks' do
|
46
58
|
inspect_source(cop,
|
47
59
|
['def m',
|
@@ -54,4 +54,9 @@ describe RuboCop::Cop::Style::SpecialGlobalVars do
|
|
54
54
|
new_source = autocorrect_source(cop, '$/')
|
55
55
|
expect(new_source).to eq('$INPUT_RECORD_SEPARATOR')
|
56
56
|
end
|
57
|
+
|
58
|
+
it 'auto-corrects #$: to #{$LOAD_PATH}' do
|
59
|
+
new_source = autocorrect_source(cop, '"#$:"')
|
60
|
+
expect(new_source).to eq('"#{$LOAD_PATH}"')
|
61
|
+
end
|
57
62
|
end
|
@@ -39,6 +39,11 @@ describe RuboCop::Cop::Style::StringLiterals, :config do
|
|
39
39
|
expect(cop.offenses).to be_empty
|
40
40
|
end
|
41
41
|
|
42
|
+
it 'accepts single quotes in interpolation' do
|
43
|
+
inspect_source(cop, [%q("hello#{hash['there']}")])
|
44
|
+
expect(cop.offenses).to be_empty
|
45
|
+
end
|
46
|
+
|
42
47
|
it 'accepts %q and %Q quotes' do
|
43
48
|
inspect_source(cop, ['a = %q(x) + %Q[x]'])
|
44
49
|
expect(cop.offenses).to be_empty
|
@@ -95,7 +100,7 @@ describe RuboCop::Cop::Style::StringLiterals, :config do
|
|
95
100
|
expect(cop.offenses).to be_empty
|
96
101
|
end
|
97
102
|
|
98
|
-
it 'accepts double quotes
|
103
|
+
it 'accepts double quotes in interpolation' do
|
99
104
|
src = ['"#{"A"}"']
|
100
105
|
inspect_source(cop, src)
|
101
106
|
expect(cop.offenses).to be_empty
|
@@ -157,6 +162,11 @@ describe RuboCop::Cop::Style::StringLiterals, :config do
|
|
157
162
|
expect(cop.offenses).to be_empty
|
158
163
|
end
|
159
164
|
|
165
|
+
it 'accepts single quotes in interpolation' do
|
166
|
+
inspect_source(cop, [%q("hello#{hash['there']}")])
|
167
|
+
expect(cop.offenses).to be_empty
|
168
|
+
end
|
169
|
+
|
160
170
|
it 'accepts %q and %Q quotes' do
|
161
171
|
inspect_source(cop, ['a = %q(x) + %Q[x]'])
|
162
172
|
expect(cop.offenses).to be_empty
|
@@ -7,7 +7,8 @@ describe RuboCop::Cop::Style::SymbolProc, :config do
|
|
7
7
|
|
8
8
|
let(:cop_config) { { 'IgnoredMethods' => %w(respond_to) } }
|
9
9
|
|
10
|
-
it 'registers an offense for a block with
|
10
|
+
it 'registers an offense for a block with parameterless method call on ' \
|
11
|
+
'param' do
|
11
12
|
inspect_source(cop, 'coll.map { |e| e.upcase }')
|
12
13
|
expect(cop.offenses.size).to eq(1)
|
13
14
|
expect(cop.messages)
|
@@ -39,6 +40,18 @@ describe RuboCop::Cop::Style::SymbolProc, :config do
|
|
39
40
|
expect(cop.offenses).to be_empty
|
40
41
|
end
|
41
42
|
|
43
|
+
it 'accepts proc with 1 argument' do
|
44
|
+
inspect_source(cop, ['proc { |x| x.method }'])
|
45
|
+
|
46
|
+
expect(cop.offenses).to be_empty
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'accepts Proc.new with 1 argument' do
|
50
|
+
inspect_source(cop, ['Proc.new { |x| x.method }'])
|
51
|
+
|
52
|
+
expect(cop.offenses).to be_empty
|
53
|
+
end
|
54
|
+
|
42
55
|
it 'accepts ignored method' do
|
43
56
|
inspect_source(cop, ['respond_to { |format| format.xml }'])
|
44
57
|
|
@@ -74,6 +87,12 @@ describe RuboCop::Cop::Style::SymbolProc, :config do
|
|
74
87
|
expect(corrected).to eq 'coll.map(&:upcase)'
|
75
88
|
end
|
76
89
|
|
90
|
+
it 'autocorrects multiple aliases with symbols as proc' do
|
91
|
+
corrected = autocorrect_source(cop, ['coll.map { |s| s.upcase }' \
|
92
|
+
'.map { |s| s.downcase }'])
|
93
|
+
expect(corrected).to eq 'coll.map(&:upcase).map(&:downcase)'
|
94
|
+
end
|
95
|
+
|
77
96
|
it 'does not crash with a bare method call' do
|
78
97
|
run = -> { inspect_source(cop, ['coll.map { |s| bare_method }']) }
|
79
98
|
expect(&run).not_to raise_error
|
@@ -10,12 +10,12 @@ describe RuboCop::Cop::Style::Tab do
|
|
10
10
|
expect(cop.offenses.size).to eq(1)
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'registers an
|
13
|
+
it 'registers an offense for a line indented with multiple tabs' do
|
14
14
|
inspect_source(cop, ["\t\t\tx = 0"])
|
15
15
|
expect(cop.offenses.size).to eq(1)
|
16
16
|
end
|
17
17
|
|
18
|
-
it 'registers an
|
18
|
+
it 'registers an offense for a line indented with mixed whitespace' do
|
19
19
|
inspect_source(cop, [" \tx = 0"])
|
20
20
|
expect(cop.offenses.size).to eq(1)
|
21
21
|
end
|
@@ -316,7 +316,7 @@ describe RuboCop::Cop::Style::TrailingComma, :config do
|
|
316
316
|
|
317
317
|
# this is a sad parse error
|
318
318
|
it 'accepts no trailing comma in a method call with a block' \
|
319
|
-
'
|
319
|
+
' parameter at the end' do
|
320
320
|
inspect_source(cop, ['some_method(',
|
321
321
|
' a,',
|
322
322
|
' b,',
|
@@ -93,4 +93,9 @@ describe RuboCop::Cop::Style::UnneededCapitalW do
|
|
93
93
|
new_source = autocorrect_source(cop, '%W(one two three)')
|
94
94
|
expect(new_source).to eq('%w(one two three)')
|
95
95
|
end
|
96
|
+
|
97
|
+
it 'auto-corrects an array of words with different bracket' do
|
98
|
+
new_source = autocorrect_source(cop, '%W[one two three]')
|
99
|
+
expect(new_source).to eq('%w[one two three]')
|
100
|
+
end
|
96
101
|
end
|
@@ -115,7 +115,7 @@ describe RuboCop::Cop::Team do
|
|
115
115
|
[RuboCop::Cop::Lint::Void, RuboCop::Cop::Metrics::LineLength]
|
116
116
|
end
|
117
117
|
|
118
|
-
it 'returns only
|
118
|
+
it 'returns only instances of the classes' do
|
119
119
|
expect(cops.size).to eq(2)
|
120
120
|
cops.sort! { |a, b| a.name <=> b.name }
|
121
121
|
expect(cops[0].name).to eq('Lint/Void')
|
@@ -137,7 +137,7 @@ describe RuboCop::Cop::Team do
|
|
137
137
|
end
|
138
138
|
let(:cop_names) { cops.map(&:name) }
|
139
139
|
|
140
|
-
it 'does not return
|
140
|
+
it 'does not return instances of the classes' do
|
141
141
|
expect(cops).not_to be_empty
|
142
142
|
expect(cop_names).not_to include('Lint/Void')
|
143
143
|
expect(cop_names).not_to include('Metrics/LineLength')
|
@@ -37,6 +37,8 @@ describe RuboCop::Options, :isolated_environment do
|
|
37
37
|
expected_help = <<-END
|
38
38
|
Usage: rubocop [options] [file1, file2, ...]
|
39
39
|
--only [COP1,COP2,...] Run only the given cop(s).
|
40
|
+
--only-guide-cops Run only cops for rules that link to a
|
41
|
+
style guide.
|
40
42
|
-c, --config FILE Specify configuration file.
|
41
43
|
--auto-gen-config Generate a configuration file acting as a
|
42
44
|
TODO list.
|
@@ -109,7 +109,7 @@ describe RuboCop::TargetFinder, :isolated_environment do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
context 'normally' do
|
112
|
-
it 'does not
|
112
|
+
it 'does not exclude them' do
|
113
113
|
expect(found_basenames)
|
114
114
|
.to eq(['ruby1.rb', 'ruby2.rb', 'executable', 'ruby3.rb'])
|
115
115
|
end
|
@@ -118,13 +118,30 @@ describe RuboCop::TargetFinder, :isolated_environment do
|
|
118
118
|
context "when it's forced to adhere file exclusion configuration" do
|
119
119
|
let(:force_exclusion) { true }
|
120
120
|
|
121
|
-
it '
|
121
|
+
it 'excludes them' do
|
122
122
|
expect(found_basenames).to eq(['ruby2.rb'])
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
+
describe '#find_files' do
|
129
|
+
let(:found_files) { target_finder.find_files(base_dir, flags) }
|
130
|
+
let(:found_basenames) { found_files.map { |f| File.basename(f) } }
|
131
|
+
let(:base_dir) { Dir.pwd }
|
132
|
+
let(:flags) { 0 }
|
133
|
+
|
134
|
+
it 'does not search excluded top level directories' do
|
135
|
+
config = double('config')
|
136
|
+
exclude_property = { 'Exclude' => [File.expand_path('dir1/**/*')] }
|
137
|
+
allow(config).to receive(:[]).with('AllCops').and_return(exclude_property)
|
138
|
+
allow(config_store).to receive(:for).and_return(config)
|
139
|
+
|
140
|
+
expect(found_basenames).not_to include('ruby1.rb')
|
141
|
+
expect(found_basenames).to include('ruby3.rb')
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
128
145
|
describe '#target_files_in_dir' do
|
129
146
|
let(:found_files) { target_finder.target_files_in_dir(base_dir) }
|
130
147
|
let(:found_basenames) { found_files.map { |f| File.basename(f) } }
|
@@ -157,6 +174,8 @@ describe RuboCop::TargetFinder, :isolated_environment do
|
|
157
174
|
allow(config).to receive(:file_to_include?) do |file|
|
158
175
|
File.basename(file) == 'file'
|
159
176
|
end
|
177
|
+
allow(config)
|
178
|
+
.to receive(:[]).with('AllCops').and_return('Exclude' => [])
|
160
179
|
allow(config).to receive(:file_to_exclude?).and_return(false)
|
161
180
|
allow(config_store).to receive(:for).and_return(config)
|
162
181
|
|
@@ -165,6 +184,8 @@ describe RuboCop::TargetFinder, :isolated_environment do
|
|
165
184
|
|
166
185
|
it 'does not pick files specified to be excluded in config' do
|
167
186
|
config = double('config').as_null_object
|
187
|
+
allow(config)
|
188
|
+
.to receive(:[]).with('AllCops').and_return('Exclude' => [])
|
168
189
|
allow(config).to receive(:file_to_include?).and_return(false)
|
169
190
|
allow(config).to receive(:file_to_exclude?) do |file|
|
170
191
|
File.basename(file) == 'ruby2.rb'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rainbow
|
@@ -324,9 +324,11 @@ files:
|
|
324
324
|
- lib/rubocop/cop/style/double_negation.rb
|
325
325
|
- lib/rubocop/cop/style/each_with_object.rb
|
326
326
|
- lib/rubocop/cop/style/else_alignment.rb
|
327
|
+
- lib/rubocop/cop/style/empty_else.rb
|
327
328
|
- lib/rubocop/cop/style/empty_line_between_defs.rb
|
328
329
|
- lib/rubocop/cop/style/empty_lines.rb
|
329
330
|
- lib/rubocop/cop/style/empty_lines_around_access_modifier.rb
|
331
|
+
- lib/rubocop/cop/style/empty_lines_around_block_body.rb
|
330
332
|
- lib/rubocop/cop/style/empty_lines_around_class_body.rb
|
331
333
|
- lib/rubocop/cop/style/empty_lines_around_method_body.rb
|
332
334
|
- lib/rubocop/cop/style/empty_lines_around_module_body.rb
|
@@ -335,6 +337,7 @@ files:
|
|
335
337
|
- lib/rubocop/cop/style/end_block.rb
|
336
338
|
- lib/rubocop/cop/style/end_of_line.rb
|
337
339
|
- lib/rubocop/cop/style/even_odd.rb
|
340
|
+
- lib/rubocop/cop/style/extra_spacing.rb
|
338
341
|
- lib/rubocop/cop/style/file_name.rb
|
339
342
|
- lib/rubocop/cop/style/flip_flop.rb
|
340
343
|
- lib/rubocop/cop/style/for.rb
|
@@ -482,6 +485,7 @@ files:
|
|
482
485
|
- relnotes/v0.26.1.md
|
483
486
|
- relnotes/v0.27.0.md
|
484
487
|
- relnotes/v0.27.1.md
|
488
|
+
- relnotes/v0.28.0.md
|
485
489
|
- rubocop.gemspec
|
486
490
|
- spec/.rubocop.yml
|
487
491
|
- spec/fixtures/html_formatter/expected.html
|
@@ -593,8 +597,10 @@ files:
|
|
593
597
|
- spec/rubocop/cop/style/double_negation_spec.rb
|
594
598
|
- spec/rubocop/cop/style/each_with_object_spec.rb
|
595
599
|
- spec/rubocop/cop/style/else_alignment_spec.rb
|
600
|
+
- spec/rubocop/cop/style/empty_else_spec.rb
|
596
601
|
- spec/rubocop/cop/style/empty_line_between_defs_spec.rb
|
597
602
|
- spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb
|
603
|
+
- spec/rubocop/cop/style/empty_lines_around_block_body_spec.rb
|
598
604
|
- spec/rubocop/cop/style/empty_lines_around_class_body_spec.rb
|
599
605
|
- spec/rubocop/cop/style/empty_lines_around_method_body_spec.rb
|
600
606
|
- spec/rubocop/cop/style/empty_lines_around_module_body_spec.rb
|
@@ -604,6 +610,7 @@ files:
|
|
604
610
|
- spec/rubocop/cop/style/end_block_spec.rb
|
605
611
|
- spec/rubocop/cop/style/end_of_line_spec.rb
|
606
612
|
- spec/rubocop/cop/style/even_odd_spec.rb
|
613
|
+
- spec/rubocop/cop/style/extra_spacing_spec.rb
|
607
614
|
- spec/rubocop/cop/style/file_name_spec.rb
|
608
615
|
- spec/rubocop/cop/style/flip_flop_spec.rb
|
609
616
|
- spec/rubocop/cop/style/for_spec.rb
|
@@ -872,8 +879,10 @@ test_files:
|
|
872
879
|
- spec/rubocop/cop/style/double_negation_spec.rb
|
873
880
|
- spec/rubocop/cop/style/each_with_object_spec.rb
|
874
881
|
- spec/rubocop/cop/style/else_alignment_spec.rb
|
882
|
+
- spec/rubocop/cop/style/empty_else_spec.rb
|
875
883
|
- spec/rubocop/cop/style/empty_line_between_defs_spec.rb
|
876
884
|
- spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb
|
885
|
+
- spec/rubocop/cop/style/empty_lines_around_block_body_spec.rb
|
877
886
|
- spec/rubocop/cop/style/empty_lines_around_class_body_spec.rb
|
878
887
|
- spec/rubocop/cop/style/empty_lines_around_method_body_spec.rb
|
879
888
|
- spec/rubocop/cop/style/empty_lines_around_module_body_spec.rb
|
@@ -883,6 +892,7 @@ test_files:
|
|
883
892
|
- spec/rubocop/cop/style/end_block_spec.rb
|
884
893
|
- spec/rubocop/cop/style/end_of_line_spec.rb
|
885
894
|
- spec/rubocop/cop/style/even_odd_spec.rb
|
895
|
+
- spec/rubocop/cop/style/extra_spacing_spec.rb
|
886
896
|
- spec/rubocop/cop/style/file_name_spec.rb
|
887
897
|
- spec/rubocop/cop/style/flip_flop_spec.rb
|
888
898
|
- spec/rubocop/cop/style/for_spec.rb
|