rubocop 0.19.1 → 0.20.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/.travis.yml +4 -0
- data/CHANGELOG.md +60 -1
- data/CONTRIBUTING.md +2 -1
- data/README.md +9 -7
- data/config/default.yml +3 -3
- data/config/disabled.yml +4 -0
- data/config/enabled.yml +45 -21
- data/lib/rubocop.rb +30 -9
- data/lib/rubocop/cli.rb +1 -1
- data/lib/rubocop/comment_config.rb +4 -2
- data/lib/rubocop/config.rb +16 -22
- data/lib/rubocop/config_loader.rb +29 -26
- data/lib/rubocop/cop/commissioner.rb +1 -1
- data/lib/rubocop/cop/cop.rb +6 -6
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/condition_position.rb +1 -1
- data/lib/rubocop/cop/lint/debugger.rb +1 -1
- data/lib/rubocop/cop/lint/deprecated_class_methods.rb +9 -7
- data/lib/rubocop/cop/lint/else_layout.rb +1 -1
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- data/lib/rubocop/cop/lint/empty_interpolation.rb +22 -0
- data/lib/rubocop/cop/lint/end_in_method.rb +1 -1
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/eval.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_condition.rb +2 -2
- data/lib/rubocop/cop/lint/literal_in_interpolation.rb +9 -0
- data/lib/rubocop/cop/lint/loop.rb +2 -2
- data/lib/rubocop/cop/lint/require_parentheses.rb +0 -4
- data/lib/rubocop/cop/lint/rescue_exception.rb +1 -1
- data/lib/rubocop/cop/lint/shadowing_outer_local_variable.rb +1 -1
- data/lib/rubocop/cop/lint/space_before_first_arg.rb +36 -0
- data/lib/rubocop/cop/lint/string_conversion_in_interpolation.rb +14 -2
- data/lib/rubocop/cop/lint/useless_access_modifier.rb +57 -0
- data/lib/rubocop/cop/lint/useless_setter_call.rb +1 -1
- data/lib/rubocop/cop/lint/void.rb +3 -3
- data/lib/rubocop/cop/mixin/space_after_punctuation.rb +1 -1
- data/lib/rubocop/cop/offense.rb +3 -21
- data/lib/rubocop/cop/rails/action_filter.rb +1 -1
- data/lib/rubocop/cop/rails/default_scope.rb +1 -1
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +1 -1
- data/lib/rubocop/cop/rails/read_write_attribute.rb +43 -0
- data/lib/rubocop/cop/rails/scope_args.rb +1 -1
- data/lib/rubocop/cop/rails/validation.rb +1 -1
- data/lib/rubocop/cop/severity.rb +76 -0
- data/lib/rubocop/cop/style/access_modifier_indentation.rb +1 -1
- data/lib/rubocop/cop/style/accessor_method_name.rb +2 -2
- data/lib/rubocop/cop/style/alias.rb +1 -1
- data/lib/rubocop/cop/style/align_hash.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +1 -1
- data/lib/rubocop/cop/style/{favor_join.rb → array_join.rb} +2 -2
- data/lib/rubocop/cop/style/begin_block.rb +1 -1
- data/lib/rubocop/cop/style/block_nesting.rb +12 -8
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +1 -1
- data/lib/rubocop/cop/style/case_equality.rb +1 -1
- data/lib/rubocop/cop/style/case_indentation.rb +5 -5
- data/lib/rubocop/cop/style/class_methods.rb +19 -3
- data/lib/rubocop/cop/style/class_vars.rb +1 -1
- data/lib/rubocop/cop/style/collection_methods.rb +17 -7
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
- data/lib/rubocop/cop/style/{def_parentheses.rb → def_with_parentheses.rb} +0 -0
- data/lib/rubocop/cop/style/{hash_methods.rb → deprecated_hash_methods.rb} +5 -4
- data/lib/rubocop/cop/style/double_negation.rb +1 -1
- data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +1 -1
- data/lib/rubocop/cop/style/end_block.rb +1 -1
- data/lib/rubocop/cop/style/even_odd.rb +2 -2
- data/lib/rubocop/cop/style/file_name.rb +1 -1
- data/lib/rubocop/cop/style/for.rb +2 -2
- data/lib/rubocop/cop/style/format_string.rb +1 -1
- data/lib/rubocop/cop/style/guard_clause.rb +69 -0
- data/lib/rubocop/cop/style/hash_syntax.rb +6 -10
- data/lib/rubocop/cop/style/if_unless_modifier.rb +2 -2
- data/lib/rubocop/cop/style/lambda.rb +2 -2
- data/lib/rubocop/cop/style/line_end_concatenation.rb +16 -9
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +2 -2
- data/lib/rubocop/cop/style/negated_if.rb +37 -0
- data/lib/rubocop/cop/style/negated_while.rb +33 -0
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +1 -1
- data/lib/rubocop/cop/style/nil_comparison.rb +14 -10
- data/lib/rubocop/cop/style/non_nil_check.rb +70 -0
- data/lib/rubocop/cop/style/not.rb +25 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +1 -1
- data/lib/rubocop/cop/style/op_method.rb +4 -4
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +1 -1
- data/lib/rubocop/cop/style/predicate_name.rb +1 -1
- data/lib/rubocop/cop/style/proc.rb +1 -1
- data/lib/rubocop/cop/style/raise_args.rb +3 -2
- data/lib/rubocop/cop/style/rescue_modifier.rb +1 -1
- data/lib/rubocop/cop/style/self_assignment.rb +2 -2
- data/lib/rubocop/cop/style/signal_exception.rb +6 -3
- data/lib/rubocop/cop/style/single_line_block_params.rb +1 -1
- data/lib/rubocop/cop/style/single_line_methods.rb +6 -5
- data/lib/rubocop/cop/style/single_space_before_first_arg.rb +41 -0
- data/lib/rubocop/cop/style/space_around_operators.rb +1 -2
- data/lib/rubocop/cop/style/special_global_vars.rb +8 -8
- data/lib/rubocop/cop/style/trailing_comma.rb +1 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +1 -1
- data/lib/rubocop/cop/style/unless_else.rb +1 -1
- data/lib/rubocop/cop/style/variable_interpolation.rb +10 -5
- data/lib/rubocop/cop/style/when_then.rb +1 -1
- data/lib/rubocop/cop/style/while_until_modifier.rb +1 -1
- data/lib/rubocop/cop/style/word_array.rb +1 -1
- data/lib/rubocop/cop/team.rb +12 -13
- data/lib/rubocop/cop/util.rb +4 -0
- data/lib/rubocop/cop/variable_inspector/locatable.rb +1 -1
- data/lib/rubocop/cop/variable_inspector/variable_table.rb +1 -1
- data/lib/rubocop/file_inspector.rb +46 -10
- data/lib/rubocop/formatter/disabled_config_formatter.rb +1 -1
- data/lib/rubocop/formatter/disabled_lines_formatter.rb +56 -0
- data/lib/rubocop/formatter/emacs_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/formatter_set.rb +2 -1
- data/lib/rubocop/formatter/fuubar_style_formatter.rb +2 -4
- data/lib/rubocop/formatter/json_formatter.rb +3 -7
- data/lib/rubocop/formatter/progress_formatter.rb +1 -3
- data/lib/rubocop/formatter/simple_text_formatter.rb +7 -3
- data/lib/rubocop/options.rb +29 -10
- data/lib/rubocop/path_util.rb +2 -1
- data/lib/rubocop/processed_source.rb +8 -0
- data/lib/rubocop/target_finder.rb +33 -12
- data/lib/rubocop/version.rb +1 -1
- data/relnotes/v0.20.0.md +69 -0
- data/rubocop-todo.yml +2 -2
- data/spec/rubocop/cli_spec.rb +269 -94
- data/spec/rubocop/config_loader_spec.rb +14 -14
- data/spec/rubocop/config_spec.rb +8 -8
- data/spec/rubocop/cop/lint/deprecated_class_methods_spec.rb +11 -6
- data/spec/rubocop/cop/lint/empty_interpolation_spec.rb +18 -0
- data/spec/rubocop/cop/lint/eval_spec.rb +2 -4
- data/spec/rubocop/cop/lint/literal_in_interpolation_spec.rb +10 -0
- data/spec/rubocop/cop/lint/rescue_exception_spec.rb +0 -8
- data/spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb +4 -4
- data/spec/rubocop/cop/lint/space_before_first_arg_spec.rb +48 -0
- data/spec/rubocop/cop/lint/string_conversion_in_interpolation_spec.rb +10 -0
- data/spec/rubocop/cop/lint/useless_access_modifier_spec.rb +154 -0
- data/spec/rubocop/cop/offense_spec.rb +1 -1
- data/spec/rubocop/cop/rails/read_write_attribute_spec.rb +19 -0
- data/spec/rubocop/cop/severity_spec.rb +113 -0
- data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +10 -10
- data/spec/rubocop/cop/style/alias_spec.rb +2 -2
- data/spec/rubocop/cop/style/and_or_spec.rb +2 -2
- data/spec/rubocop/cop/style/{favor_join_spec.rb → array_join_spec.rb} +1 -3
- data/spec/rubocop/cop/style/block_nesting_spec.rb +4 -4
- data/spec/rubocop/cop/style/case_equality_spec.rb +1 -0
- data/spec/rubocop/cop/style/case_indentation_spec.rb +12 -9
- data/spec/rubocop/cop/style/class_methods_spec.rb +23 -0
- data/spec/rubocop/cop/style/collection_methods_spec.rb +2 -2
- data/spec/rubocop/cop/style/{hash_methods_spec.rb → deprecated_hash_methods_spec.rb} +3 -3
- data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/style/even_odd_spec.rb +8 -8
- data/spec/rubocop/cop/style/file_name_spec.rb +55 -42
- data/spec/rubocop/cop/style/for_spec.rb +4 -4
- data/spec/rubocop/cop/style/format_string_spec.rb +10 -10
- data/spec/rubocop/cop/style/guard_clause_spec.rb +77 -0
- data/spec/rubocop/cop/style/hash_syntax_spec.rb +4 -2
- data/spec/rubocop/cop/style/if_unless_modifier_spec.rb +4 -4
- data/spec/rubocop/cop/style/lambda_spec.rb +2 -2
- data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +21 -0
- data/spec/rubocop/cop/style/multiline_if_then_spec.rb +1 -1
- data/spec/rubocop/cop/style/{favor_unless_over_negated_if_spec.rb → negated_if_spec.rb} +8 -3
- data/spec/rubocop/cop/style/{favor_until_over_negated_while_spec.rb → negated_while_spec.rb} +8 -3
- data/spec/rubocop/cop/style/nil_comparison_spec.rb +7 -13
- data/spec/rubocop/cop/style/non_nil_check_spec.rb +35 -0
- data/spec/rubocop/cop/style/not_spec.rb +11 -0
- data/spec/rubocop/cop/style/numeric_literals_spec.rb +0 -2
- data/spec/rubocop/cop/style/op_method_spec.rb +10 -2
- data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +2 -2
- data/spec/rubocop/cop/style/predicate_name_spec.rb +2 -1
- data/spec/rubocop/cop/style/raise_args_spec.rb +5 -0
- data/spec/rubocop/cop/style/rescue_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/style/self_assignment_spec.rb +4 -4
- data/spec/rubocop/cop/style/signal_exception_spec.rb +24 -0
- data/spec/rubocop/cop/style/single_line_block_params_spec.rb +2 -0
- data/spec/rubocop/cop/style/single_space_before_first_arg_spec.rb +63 -0
- data/spec/rubocop/cop/style/special_global_vars_spec.rb +6 -5
- data/spec/rubocop/cop/style/trivial_accessors_spec.rb +6 -3
- data/spec/rubocop/cop/style/unless_else_spec.rb +2 -4
- data/spec/rubocop/cop/style/variable_interpolation_spec.rb +15 -6
- data/spec/rubocop/cop/style/when_then_spec.rb +3 -4
- data/spec/rubocop/cop/team_spec.rb +4 -18
- data/spec/rubocop/file_inspector_spec.rb +4 -0
- data/spec/rubocop/formatter/disabled_config_formatter_spec.rb +1 -1
- data/spec/rubocop/formatter/disabled_lines_formatter_spec.rb +69 -0
- data/spec/rubocop/options_spec.rb +5 -0
- data/spec/rubocop/target_finder_spec.rb +42 -11
- data/spec/support/shared_context.rb +1 -1
- data/spec/support/statement_modifier_helper.rb +1 -1
- metadata +75 -50
- data/lib/rubocop/cop/rails/read_attribute.rb +0 -28
- data/lib/rubocop/cop/style/favor_unless_over_negated_if.rb +0 -24
- data/lib/rubocop/cop/style/favor_until_over_negated_while.rb +0 -20
- data/spec/rubocop/cop/rails/read_attribute_spec.rb +0 -13
@@ -9,34 +9,35 @@ describe Rubocop::Cop::Style::SpecialGlobalVars do
|
|
9
9
|
inspect_source(cop, ['puts $:'])
|
10
10
|
expect(cop.offenses.size).to eq(1)
|
11
11
|
expect(cop.messages)
|
12
|
-
.to eq(['Prefer
|
12
|
+
.to eq(['Prefer `$LOAD_PATH` over `$:`.'])
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'registers an offense for $"' do
|
16
16
|
inspect_source(cop, ['puts $"'])
|
17
17
|
expect(cop.offenses.size).to eq(1)
|
18
18
|
expect(cop.messages)
|
19
|
-
.to eq(['Prefer
|
19
|
+
.to eq(['Prefer `$LOADED_FEATURES` over `$"`.'])
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'registers an offense for $0' do
|
23
23
|
inspect_source(cop, ['puts $0'])
|
24
24
|
expect(cop.offenses.size).to eq(1)
|
25
25
|
expect(cop.messages)
|
26
|
-
.to eq(['Prefer
|
26
|
+
.to eq(['Prefer `$PROGRAM_NAME` over `$0`.'])
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'registers an offense for $$' do
|
30
30
|
inspect_source(cop, ['puts $$'])
|
31
31
|
expect(cop.offenses.size).to eq(1)
|
32
32
|
expect(cop.messages)
|
33
|
-
.to eq(['Prefer
|
33
|
+
.to eq(['Prefer `$PROCESS_ID` or `$PID` from the English ' \
|
34
|
+
'library over `$$`.'])
|
34
35
|
end
|
35
36
|
|
36
37
|
it 'is clear about variables from the English library vs those not' do
|
37
38
|
inspect_source(cop, ['puts $*'])
|
38
39
|
expect(cop.messages)
|
39
|
-
.to eq(['Prefer
|
40
|
+
.to eq(['Prefer `$ARGV` from the English library, or `ARGV` over `$*`.'])
|
40
41
|
end
|
41
42
|
|
42
43
|
it 'does not register an offense for backrefs like $1' do
|
@@ -17,7 +17,9 @@ describe Rubocop::Cop::Style::TrivialAccessors, :config do
|
|
17
17
|
'end'])
|
18
18
|
expect(cop.offenses.size).to eq(2)
|
19
19
|
expect(cop.offenses
|
20
|
-
|
20
|
+
.map(&:line).sort).to eq([1, 5])
|
21
|
+
expect(cop.messages)
|
22
|
+
.to eq(['Use `attr_reader` to define trivial reader methods.'] * 2)
|
21
23
|
end
|
22
24
|
|
23
25
|
it 'finds trivial reader in a class' do
|
@@ -146,8 +148,9 @@ describe Rubocop::Cop::Style::TrivialAccessors, :config do
|
|
146
148
|
' end',
|
147
149
|
'end'])
|
148
150
|
expect(cop.offenses.size).to eq(1)
|
149
|
-
expect(cop.offenses
|
150
|
-
|
151
|
+
expect(cop.offenses .map(&:line).sort).to eq([3])
|
152
|
+
expect(cop.messages)
|
153
|
+
.to eq(['Use `attr_writer` to define trivial writer methods.'])
|
151
154
|
end
|
152
155
|
|
153
156
|
it 'does not find trivial writer with function calls' do
|
@@ -11,15 +11,13 @@ describe Rubocop::Cop::Style::UnlessElse do
|
|
11
11
|
'else',
|
12
12
|
' a = 0',
|
13
13
|
'end'])
|
14
|
-
expect(cop.
|
15
|
-
['Never use unless with else. Rewrite these with the ' \
|
16
|
-
'positive case first.'])
|
14
|
+
expect(cop.offenses.size).to eq(1)
|
17
15
|
end
|
18
16
|
|
19
17
|
it 'accepts an unless without else' do
|
20
18
|
inspect_source(cop, ['unless x',
|
21
19
|
' a = 1',
|
22
20
|
'end'])
|
23
|
-
expect(cop.
|
21
|
+
expect(cop.offenses).to be_empty
|
24
22
|
end
|
25
23
|
end
|
@@ -9,34 +9,38 @@ describe Rubocop::Cop::Style::VariableInterpolation do
|
|
9
9
|
inspect_source(cop,
|
10
10
|
['puts "this is a #$test"'])
|
11
11
|
expect(cop.offenses.size).to eq(1)
|
12
|
+
expect(cop.highlights).to eq(['$test'])
|
12
13
|
expect(cop.messages)
|
13
|
-
.to eq(['Replace interpolated
|
14
|
-
' with expression
|
14
|
+
.to eq(['Replace interpolated variable `$test`' \
|
15
|
+
' with expression `#{$test}`.'])
|
15
16
|
end
|
16
17
|
|
17
18
|
it 'registers an offense for interpolated regexp back references' do
|
18
19
|
inspect_source(cop,
|
19
20
|
['puts "this is a #$1"'])
|
20
21
|
expect(cop.offenses.size).to eq(1)
|
22
|
+
expect(cop.highlights).to eq(['$1'])
|
21
23
|
expect(cop.messages)
|
22
|
-
.to eq(['Replace interpolated
|
24
|
+
.to eq(['Replace interpolated variable `$1` with expression `#{$1}`.'])
|
23
25
|
end
|
24
26
|
|
25
27
|
it 'registers an offense for interpolated instance variables' do
|
26
28
|
inspect_source(cop,
|
27
29
|
['puts "this is a #@test"'])
|
28
30
|
expect(cop.offenses.size).to eq(1)
|
31
|
+
expect(cop.highlights).to eq(['@test'])
|
29
32
|
expect(cop.messages)
|
30
|
-
.to eq(['Replace interpolated
|
31
|
-
' with expression
|
33
|
+
.to eq(['Replace interpolated variable `@test`' \
|
34
|
+
' with expression `#{@test}`.'])
|
32
35
|
end
|
33
36
|
|
34
37
|
it 'registers an offense for interpolated class variables' do
|
35
38
|
inspect_source(cop,
|
36
39
|
['puts "this is a #@@t"'])
|
37
40
|
expect(cop.offenses.size).to eq(1)
|
41
|
+
expect(cop.highlights).to eq(['@@t'])
|
38
42
|
expect(cop.messages)
|
39
|
-
.to eq(['Replace interpolated
|
43
|
+
.to eq(['Replace interpolated variable `@@t` with expression `#{@@t}`.'])
|
40
44
|
end
|
41
45
|
|
42
46
|
it 'does not register an offense for variables in expressions' do
|
@@ -44,4 +48,9 @@ describe Rubocop::Cop::Style::VariableInterpolation do
|
|
44
48
|
['puts "this is a #{@test} #{@@t} #{$t} #{$1}"'])
|
45
49
|
expect(cop.offenses).to be_empty
|
46
50
|
end
|
51
|
+
|
52
|
+
it 'autocorrects by adding the missing {}' do
|
53
|
+
corrected = autocorrect_source(cop, ['"some #@var"'])
|
54
|
+
expect(corrected).to eq '"some #{@var}"'
|
55
|
+
end
|
47
56
|
end
|
@@ -9,15 +9,14 @@ describe Rubocop::Cop::Style::WhenThen do
|
|
9
9
|
inspect_source(cop, ['case a',
|
10
10
|
'when b; c',
|
11
11
|
'end'])
|
12
|
-
expect(cop.
|
13
|
-
['Never use "when x;". Use "when x then" instead.'])
|
12
|
+
expect(cop.offenses.size).to eq(1)
|
14
13
|
end
|
15
14
|
|
16
15
|
it 'accepts when x then' do
|
17
16
|
inspect_source(cop, ['case a',
|
18
17
|
'when b then c',
|
19
18
|
'end'])
|
20
|
-
expect(cop.
|
19
|
+
expect(cop.offenses).to be_empty
|
21
20
|
end
|
22
21
|
|
23
22
|
it 'accepts ; separating statements in the body of when' do
|
@@ -29,7 +28,7 @@ describe Rubocop::Cop::Style::WhenThen do
|
|
29
28
|
'when f',
|
30
29
|
' g; h',
|
31
30
|
'end'])
|
32
|
-
expect(cop.
|
31
|
+
expect(cop.offenses).to be_empty
|
33
32
|
end
|
34
33
|
|
35
34
|
it 'auto-corrects "when x;" with "when x then"' do
|
@@ -40,7 +40,9 @@ describe Rubocop::Cop::Team do
|
|
40
40
|
include FileHelper
|
41
41
|
|
42
42
|
let(:file_path) { '/tmp/example.rb' }
|
43
|
-
let(:offenses)
|
43
|
+
let(:offenses) do
|
44
|
+
team.inspect_file(Rubocop::SourceParser.parse_file(file_path))
|
45
|
+
end
|
44
46
|
|
45
47
|
before do
|
46
48
|
create_file(file_path, [
|
@@ -54,22 +56,6 @@ describe Rubocop::Cop::Team do
|
|
54
56
|
expect(offenses.all? { |o| o.is_a?(Rubocop::Cop::Offense) }).to be_true
|
55
57
|
end
|
56
58
|
|
57
|
-
context 'when Parser cannot parse the file' do
|
58
|
-
before do
|
59
|
-
create_file(file_path, [
|
60
|
-
'#' * 90,
|
61
|
-
'class Test'
|
62
|
-
])
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'returns only error offenses' do
|
66
|
-
expect(offenses.size).to eq(1)
|
67
|
-
offense = offenses.first
|
68
|
-
expect(offense.cop_name).to eq('Syntax')
|
69
|
-
expect(offense.severity).to eq(:error)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
59
|
context 'when Parser reports non-fatal warning for the file' do
|
74
60
|
before do
|
75
61
|
create_file(file_path, [
|
@@ -101,7 +87,7 @@ describe Rubocop::Cop::Team do
|
|
101
87
|
end
|
102
88
|
|
103
89
|
it 'does autocorrection' do
|
104
|
-
team.inspect_file(file_path)
|
90
|
+
team.inspect_file(Rubocop::SourceParser.parse_file(file_path))
|
105
91
|
corrected_source = File.read(file_path)
|
106
92
|
expect(corrected_source).to eq([
|
107
93
|
'# encoding: utf-8',
|
@@ -18,6 +18,10 @@ describe Rubocop::FileInspector do
|
|
18
18
|
$stdout = StringIO.new
|
19
19
|
$stderr = StringIO.new
|
20
20
|
|
21
|
+
allow(inspector).to receive(:process_source) do
|
22
|
+
[double('ProcessedSource').as_null_object, []]
|
23
|
+
end
|
24
|
+
|
21
25
|
allow(inspector).to receive(:inspect_file) do
|
22
26
|
inspector.errors = errors
|
23
27
|
[offenses, !:updated_source_file]
|
@@ -39,7 +39,7 @@ module Rubocop
|
|
39
39
|
''].join("\n"))
|
40
40
|
expect($stdout.string)
|
41
41
|
.to eq(['Created rubocop-todo.yml.',
|
42
|
-
'Run rubocop
|
42
|
+
'Run `rubocop --config rubocop-todo.yml`, or',
|
43
43
|
'add inherit_from: rubocop-todo.yml in a .rubocop.yml ' \
|
44
44
|
'file.',
|
45
45
|
''].join("\n"))
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'stringio'
|
5
|
+
require 'tempfile'
|
6
|
+
|
7
|
+
module Rubocop
|
8
|
+
module Formatter
|
9
|
+
describe DisabledLinesFormatter do
|
10
|
+
subject(:formatter) { described_class.new(output) }
|
11
|
+
let(:output) { StringIO.new }
|
12
|
+
|
13
|
+
let(:files) do
|
14
|
+
%w(lib/rubocop.rb spec/spec_helper.rb bin/rubocop).map do |path|
|
15
|
+
File.expand_path(path)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:file_started) do
|
20
|
+
formatter.file_started(files.first, cop_disabled_line_ranges)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#file_started' do
|
24
|
+
before { formatter.started(files) }
|
25
|
+
|
26
|
+
context 'when no disable cop comments are detected' do
|
27
|
+
let(:cop_disabled_line_ranges) { {} }
|
28
|
+
it 'shouldn\'t add to cop_disabled_line_ranges' do
|
29
|
+
expect { file_started }.to_not(
|
30
|
+
change { formatter.cop_disabled_line_ranges })
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when any disable cop comments are detected' do
|
35
|
+
let(:cop_disabled_line_ranges) do
|
36
|
+
{ cop_disabled_line_ranges: { 'LineLength' => [1..1] } }
|
37
|
+
end
|
38
|
+
it 'should merge the changes into cop_disabled_line_ranges' do
|
39
|
+
expect { file_started }.to(
|
40
|
+
change { formatter.cop_disabled_line_ranges })
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#finished' do
|
46
|
+
context 'when there disabled cops detected' do
|
47
|
+
let(:cop_disabled_line_ranges) do
|
48
|
+
{ cop_disabled_line_ranges: { 'LineLength' => [1..1] } }
|
49
|
+
end
|
50
|
+
|
51
|
+
before do
|
52
|
+
formatter.started(files)
|
53
|
+
formatter.file_started('lib/rubocop.rb', cop_disabled_line_ranges)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'lists disabled cops by file' do
|
57
|
+
formatter.finished(files)
|
58
|
+
expect(output.string).to eq(
|
59
|
+
['',
|
60
|
+
'Cops disabled line ranges:',
|
61
|
+
'',
|
62
|
+
'lib/rubocop.rb:1..1: LineLength',
|
63
|
+
''].join("\n"))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -40,12 +40,16 @@ Usage: rubocop [options] [file1, file2, ...]
|
|
40
40
|
-c, --config FILE Specify configuration file.
|
41
41
|
--auto-gen-config Generate a configuration file acting as a
|
42
42
|
TODO list.
|
43
|
+
--force-exclusion Force excluding files specified in the
|
44
|
+
configuration `Exclude` even if they are
|
45
|
+
explicitly passed as arguments.
|
43
46
|
-f, --format FORMATTER Choose an output formatter. This option
|
44
47
|
can be specified multiple times to enable
|
45
48
|
multiple formatters at the same time.
|
46
49
|
[p]rogress (default)
|
47
50
|
[s]imple
|
48
51
|
[c]lang
|
52
|
+
[d]isabled cops via inline comments
|
49
53
|
[fu]ubar
|
50
54
|
[e]macs
|
51
55
|
[j]son
|
@@ -57,6 +61,7 @@ Usage: rubocop [options] [file1, file2, ...]
|
|
57
61
|
specified --format, or the default format
|
58
62
|
if no format is specified.
|
59
63
|
-r, --require FILE Require Ruby file.
|
64
|
+
--fail-level SEVERITY Minimum severity for exit with error code.
|
60
65
|
--show-cops [cop1,cop2,...] Shows the given cops, or all cops by
|
61
66
|
default, and their configurations for the
|
62
67
|
current directory.
|
@@ -5,8 +5,12 @@ require 'spec_helper'
|
|
5
5
|
describe Rubocop::TargetFinder, :isolated_environment do
|
6
6
|
include FileHelper
|
7
7
|
|
8
|
-
subject(:target_finder)
|
8
|
+
subject(:target_finder) do
|
9
|
+
described_class.new(config_store, options)
|
10
|
+
end
|
9
11
|
let(:config_store) { Rubocop::ConfigStore.new }
|
12
|
+
let(:options) { { force_exclusion: force_exclusion, debug: debug } }
|
13
|
+
let(:force_exclusion) { false }
|
10
14
|
let(:debug) { false }
|
11
15
|
|
12
16
|
before do
|
@@ -82,6 +86,43 @@ describe Rubocop::TargetFinder, :isolated_environment do
|
|
82
86
|
expect(count).to eq(1)
|
83
87
|
end
|
84
88
|
end
|
89
|
+
|
90
|
+
context 'when some paths are specified in the configuration Exclude ' \
|
91
|
+
'and they are explicitly passed as arguments' do
|
92
|
+
before do
|
93
|
+
create_file('.rubocop.yml', [
|
94
|
+
'AllCops:',
|
95
|
+
' Exclude:',
|
96
|
+
' - dir1/ruby1.rb',
|
97
|
+
" - 'dir2/*'"
|
98
|
+
])
|
99
|
+
|
100
|
+
create_file('dir1/.rubocop.yml', [
|
101
|
+
'AllCops:',
|
102
|
+
' Exclude:',
|
103
|
+
' - executable'
|
104
|
+
])
|
105
|
+
end
|
106
|
+
|
107
|
+
let(:args) do
|
108
|
+
['dir1/ruby1.rb', 'dir1/ruby2.rb', 'dir1/exe*', 'dir2/ruby3.rb']
|
109
|
+
end
|
110
|
+
|
111
|
+
context 'normally' do
|
112
|
+
it 'does not exludes them' do
|
113
|
+
expect(found_basenames)
|
114
|
+
.to eq(['ruby1.rb', 'ruby2.rb', 'executable', 'ruby3.rb'])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "when it's forced to adhere file exclusion configuration" do
|
119
|
+
let(:force_exclusion) { true }
|
120
|
+
|
121
|
+
it 'exludes them' do
|
122
|
+
expect(found_basenames).to eq(['ruby2.rb'])
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
85
126
|
end
|
86
127
|
|
87
128
|
describe '#target_files_in_dir' do
|
@@ -133,16 +174,6 @@ describe Rubocop::TargetFinder, :isolated_environment do
|
|
133
174
|
expect(found_basenames).not_to include('ruby2.rb')
|
134
175
|
end
|
135
176
|
|
136
|
-
it 'does not return duplicated paths' do
|
137
|
-
config = double('config').as_null_object
|
138
|
-
allow(config).to receive(:file_to_include?).and_return(true)
|
139
|
-
allow(config).to receive(:file_to_exclude?).and_return(false)
|
140
|
-
allow(config_store).to receive(:for).and_return(config)
|
141
|
-
|
142
|
-
count = found_basenames.count { |f| f == 'ruby1.rb' }
|
143
|
-
expect(count).to eq(1)
|
144
|
-
end
|
145
|
-
|
146
177
|
context 'when an exception is raised while reading file' do
|
147
178
|
around do |example|
|
148
179
|
original_stderr = $stderr
|
@@ -12,7 +12,7 @@ module StatementModifierHelper
|
|
12
12
|
' b',
|
13
13
|
'end'])
|
14
14
|
expect(cop.messages).to eq(
|
15
|
-
["Favor modifier
|
15
|
+
["Favor modifier `#{keyword}` usage when having a single-line body."])
|
16
16
|
expect(cop.offenses.map { |o| o.location.source }).to eq([keyword])
|
17
17
|
end
|
18
18
|
|
metadata
CHANGED
@@ -1,165 +1,165 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.99.1
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '3.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.99.1
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: parser
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 2.1.7
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ~>
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.1.7
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: powerpack
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - ~>
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 0.0.6
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - ~>
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 0.0.6
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: json
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 1.7.7
|
68
|
-
- - <
|
68
|
+
- - "<"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '2'
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 1.7.7
|
78
|
-
- - <
|
78
|
+
- - "<"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '2'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: ruby-progressbar
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - ~>
|
85
|
+
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '1.4'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - ~>
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '1.4'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: rake
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- - ~>
|
99
|
+
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '10.1'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- - ~>
|
106
|
+
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '10.1'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: rspec
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- - ~>
|
113
|
+
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '2.14'
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- - ~>
|
120
|
+
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '2.14'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: yard
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - ~>
|
127
|
+
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0.8'
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- - ~>
|
134
|
+
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0.8'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: bundler
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
|
-
- - ~>
|
141
|
+
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '1.3'
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- - ~>
|
148
|
+
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '1.3'
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: simplecov
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- - ~>
|
155
|
+
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0.7'
|
158
158
|
type: :development
|
159
159
|
prerelease: false
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- - ~>
|
162
|
+
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0.7'
|
165
165
|
description: |2
|
@@ -173,11 +173,11 @@ extra_rdoc_files:
|
|
173
173
|
- LICENSE.txt
|
174
174
|
- README.md
|
175
175
|
files:
|
176
|
-
- .gitignore
|
177
|
-
- .rspec
|
178
|
-
- .rubocop.yml
|
179
|
-
- .travis.yml
|
180
|
-
- .yardopts
|
176
|
+
- ".gitignore"
|
177
|
+
- ".rspec"
|
178
|
+
- ".rubocop.yml"
|
179
|
+
- ".travis.yml"
|
180
|
+
- ".yardopts"
|
181
181
|
- CHANGELOG.md
|
182
182
|
- CONTRIBUTING.md
|
183
183
|
- Gemfile
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- lib/rubocop/cop/lint/deprecated_class_methods.rb
|
208
208
|
- lib/rubocop/cop/lint/else_layout.rb
|
209
209
|
- lib/rubocop/cop/lint/empty_ensure.rb
|
210
|
+
- lib/rubocop/cop/lint/empty_interpolation.rb
|
210
211
|
- lib/rubocop/cop/lint/end_alignment.rb
|
211
212
|
- lib/rubocop/cop/lint/end_in_method.rb
|
212
213
|
- lib/rubocop/cop/lint/ensure_return.rb
|
@@ -220,9 +221,11 @@ files:
|
|
220
221
|
- lib/rubocop/cop/lint/require_parentheses.rb
|
221
222
|
- lib/rubocop/cop/lint/rescue_exception.rb
|
222
223
|
- lib/rubocop/cop/lint/shadowing_outer_local_variable.rb
|
224
|
+
- lib/rubocop/cop/lint/space_before_first_arg.rb
|
223
225
|
- lib/rubocop/cop/lint/string_conversion_in_interpolation.rb
|
224
226
|
- lib/rubocop/cop/lint/syntax.rb
|
225
227
|
- lib/rubocop/cop/lint/unreachable_code.rb
|
228
|
+
- lib/rubocop/cop/lint/useless_access_modifier.rb
|
226
229
|
- lib/rubocop/cop/lint/useless_assignment.rb
|
227
230
|
- lib/rubocop/cop/lint/useless_comparison.rb
|
228
231
|
- lib/rubocop/cop/lint/useless_else_without_rescue.rb
|
@@ -252,9 +255,10 @@ files:
|
|
252
255
|
- lib/rubocop/cop/rails/default_scope.rb
|
253
256
|
- lib/rubocop/cop/rails/has_and_belongs_to_many.rb
|
254
257
|
- lib/rubocop/cop/rails/output.rb
|
255
|
-
- lib/rubocop/cop/rails/
|
258
|
+
- lib/rubocop/cop/rails/read_write_attribute.rb
|
256
259
|
- lib/rubocop/cop/rails/scope_args.rb
|
257
260
|
- lib/rubocop/cop/rails/validation.rb
|
261
|
+
- lib/rubocop/cop/severity.rb
|
258
262
|
- lib/rubocop/cop/style/access_modifier_indentation.rb
|
259
263
|
- lib/rubocop/cop/style/accessor_method_name.rb
|
260
264
|
- lib/rubocop/cop/style/alias.rb
|
@@ -262,6 +266,7 @@ files:
|
|
262
266
|
- lib/rubocop/cop/style/align_hash.rb
|
263
267
|
- lib/rubocop/cop/style/align_parameters.rb
|
264
268
|
- lib/rubocop/cop/style/and_or.rb
|
269
|
+
- lib/rubocop/cop/style/array_join.rb
|
265
270
|
- lib/rubocop/cop/style/ascii_comments.rb
|
266
271
|
- lib/rubocop/cop/style/ascii_identifiers.rb
|
267
272
|
- lib/rubocop/cop/style/attr.rb
|
@@ -283,7 +288,8 @@ files:
|
|
283
288
|
- lib/rubocop/cop/style/comment_annotation.rb
|
284
289
|
- lib/rubocop/cop/style/constant_name.rb
|
285
290
|
- lib/rubocop/cop/style/cyclomatic_complexity.rb
|
286
|
-
- lib/rubocop/cop/style/
|
291
|
+
- lib/rubocop/cop/style/def_with_parentheses.rb
|
292
|
+
- lib/rubocop/cop/style/deprecated_hash_methods.rb
|
287
293
|
- lib/rubocop/cop/style/documentation.rb
|
288
294
|
- lib/rubocop/cop/style/dot_position.rb
|
289
295
|
- lib/rubocop/cop/style/double_negation.rb
|
@@ -296,16 +302,13 @@ files:
|
|
296
302
|
- lib/rubocop/cop/style/end_block.rb
|
297
303
|
- lib/rubocop/cop/style/end_of_line.rb
|
298
304
|
- lib/rubocop/cop/style/even_odd.rb
|
299
|
-
- lib/rubocop/cop/style/favor_join.rb
|
300
|
-
- lib/rubocop/cop/style/favor_unless_over_negated_if.rb
|
301
|
-
- lib/rubocop/cop/style/favor_until_over_negated_while.rb
|
302
305
|
- lib/rubocop/cop/style/file_name.rb
|
303
306
|
- lib/rubocop/cop/style/final_newline.rb
|
304
307
|
- lib/rubocop/cop/style/flip_flop.rb
|
305
308
|
- lib/rubocop/cop/style/for.rb
|
306
309
|
- lib/rubocop/cop/style/format_string.rb
|
307
310
|
- lib/rubocop/cop/style/global_vars.rb
|
308
|
-
- lib/rubocop/cop/style/
|
311
|
+
- lib/rubocop/cop/style/guard_clause.rb
|
309
312
|
- lib/rubocop/cop/style/hash_syntax.rb
|
310
313
|
- lib/rubocop/cop/style/if_unless_modifier.rb
|
311
314
|
- lib/rubocop/cop/style/if_with_semicolon.rb
|
@@ -327,8 +330,11 @@ files:
|
|
327
330
|
- lib/rubocop/cop/style/multiline_block_chain.rb
|
328
331
|
- lib/rubocop/cop/style/multiline_if_then.rb
|
329
332
|
- lib/rubocop/cop/style/multiline_ternary_operator.rb
|
333
|
+
- lib/rubocop/cop/style/negated_if.rb
|
334
|
+
- lib/rubocop/cop/style/negated_while.rb
|
330
335
|
- lib/rubocop/cop/style/nested_ternary_operator.rb
|
331
336
|
- lib/rubocop/cop/style/nil_comparison.rb
|
337
|
+
- lib/rubocop/cop/style/non_nil_check.rb
|
332
338
|
- lib/rubocop/cop/style/not.rb
|
333
339
|
- lib/rubocop/cop/style/numeric_literals.rb
|
334
340
|
- lib/rubocop/cop/style/one_line_conditional.rb
|
@@ -351,6 +357,7 @@ files:
|
|
351
357
|
- lib/rubocop/cop/style/signal_exception.rb
|
352
358
|
- lib/rubocop/cop/style/single_line_block_params.rb
|
353
359
|
- lib/rubocop/cop/style/single_line_methods.rb
|
360
|
+
- lib/rubocop/cop/style/single_space_before_first_arg.rb
|
354
361
|
- lib/rubocop/cop/style/space_after_colon.rb
|
355
362
|
- lib/rubocop/cop/style/space_after_comma.rb
|
356
363
|
- lib/rubocop/cop/style/space_after_control_keyword.rb
|
@@ -394,6 +401,7 @@ files:
|
|
394
401
|
- lib/rubocop/formatter/clang_style_formatter.rb
|
395
402
|
- lib/rubocop/formatter/colorizable.rb
|
396
403
|
- lib/rubocop/formatter/disabled_config_formatter.rb
|
404
|
+
- lib/rubocop/formatter/disabled_lines_formatter.rb
|
397
405
|
- lib/rubocop/formatter/emacs_style_formatter.rb
|
398
406
|
- lib/rubocop/formatter/file_list_formatter.rb
|
399
407
|
- lib/rubocop/formatter/formatter_set.rb
|
@@ -412,6 +420,7 @@ files:
|
|
412
420
|
- lib/rubocop/version.rb
|
413
421
|
- relnotes/v0.19.0.md
|
414
422
|
- relnotes/v0.19.1.md
|
423
|
+
- relnotes/v0.20.0.md
|
415
424
|
- rubocop-todo.yml
|
416
425
|
- rubocop.gemspec
|
417
426
|
- spec/.rubocop.yml
|
@@ -434,6 +443,7 @@ files:
|
|
434
443
|
- spec/rubocop/cop/lint/deprecated_class_methods_spec.rb
|
435
444
|
- spec/rubocop/cop/lint/else_layout_spec.rb
|
436
445
|
- spec/rubocop/cop/lint/empty_ensure_spec.rb
|
446
|
+
- spec/rubocop/cop/lint/empty_interpolation_spec.rb
|
437
447
|
- spec/rubocop/cop/lint/end_alignment_spec.rb
|
438
448
|
- spec/rubocop/cop/lint/end_in_method_spec.rb
|
439
449
|
- spec/rubocop/cop/lint/ensure_return_spec.rb
|
@@ -447,9 +457,11 @@ files:
|
|
447
457
|
- spec/rubocop/cop/lint/require_parentheses_spec.rb
|
448
458
|
- spec/rubocop/cop/lint/rescue_exception_spec.rb
|
449
459
|
- spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb
|
460
|
+
- spec/rubocop/cop/lint/space_before_first_arg_spec.rb
|
450
461
|
- spec/rubocop/cop/lint/string_conversion_in_interpolation_spec.rb
|
451
462
|
- spec/rubocop/cop/lint/syntax_spec.rb
|
452
463
|
- spec/rubocop/cop/lint/unreachable_code_spec.rb
|
464
|
+
- spec/rubocop/cop/lint/useless_access_modifier_spec.rb
|
453
465
|
- spec/rubocop/cop/lint/useless_assignment_spec.rb
|
454
466
|
- spec/rubocop/cop/lint/useless_comparison_spec.rb
|
455
467
|
- spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb
|
@@ -460,9 +472,10 @@ files:
|
|
460
472
|
- spec/rubocop/cop/rails/default_scope_spec.rb
|
461
473
|
- spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb
|
462
474
|
- spec/rubocop/cop/rails/output_spec.rb
|
463
|
-
- spec/rubocop/cop/rails/
|
475
|
+
- spec/rubocop/cop/rails/read_write_attribute_spec.rb
|
464
476
|
- spec/rubocop/cop/rails/scope_args_spec.rb
|
465
477
|
- spec/rubocop/cop/rails/validation_spec.rb
|
478
|
+
- spec/rubocop/cop/severity_spec.rb
|
466
479
|
- spec/rubocop/cop/style/access_modifier_indentation_spec.rb
|
467
480
|
- spec/rubocop/cop/style/accessor_method_name_spec.rb
|
468
481
|
- spec/rubocop/cop/style/alias_spec.rb
|
@@ -470,6 +483,7 @@ files:
|
|
470
483
|
- spec/rubocop/cop/style/align_hash_spec.rb
|
471
484
|
- spec/rubocop/cop/style/align_parameters_spec.rb
|
472
485
|
- spec/rubocop/cop/style/and_or_spec.rb
|
486
|
+
- spec/rubocop/cop/style/array_join_spec.rb
|
473
487
|
- spec/rubocop/cop/style/ascii_comments_spec.rb
|
474
488
|
- spec/rubocop/cop/style/ascii_identifiers_spec.rb
|
475
489
|
- spec/rubocop/cop/style/attr_spec.rb
|
@@ -492,6 +506,7 @@ files:
|
|
492
506
|
- spec/rubocop/cop/style/constant_name_spec.rb
|
493
507
|
- spec/rubocop/cop/style/cyclomatic_complexity_spec.rb
|
494
508
|
- spec/rubocop/cop/style/def_with_parentheses_spec.rb
|
509
|
+
- spec/rubocop/cop/style/deprecated_hash_methods_spec.rb
|
495
510
|
- spec/rubocop/cop/style/documentation_spec.rb
|
496
511
|
- spec/rubocop/cop/style/dot_position_spec.rb
|
497
512
|
- spec/rubocop/cop/style/double_negation_spec.rb
|
@@ -504,16 +519,13 @@ files:
|
|
504
519
|
- spec/rubocop/cop/style/end_block_spec.rb
|
505
520
|
- spec/rubocop/cop/style/end_of_line_spec.rb
|
506
521
|
- spec/rubocop/cop/style/even_odd_spec.rb
|
507
|
-
- spec/rubocop/cop/style/favor_join_spec.rb
|
508
|
-
- spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb
|
509
|
-
- spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb
|
510
522
|
- spec/rubocop/cop/style/file_name_spec.rb
|
511
523
|
- spec/rubocop/cop/style/final_newline_spec.rb
|
512
524
|
- spec/rubocop/cop/style/flip_flop_spec.rb
|
513
525
|
- spec/rubocop/cop/style/for_spec.rb
|
514
526
|
- spec/rubocop/cop/style/format_string_spec.rb
|
515
527
|
- spec/rubocop/cop/style/global_vars_spec.rb
|
516
|
-
- spec/rubocop/cop/style/
|
528
|
+
- spec/rubocop/cop/style/guard_clause_spec.rb
|
517
529
|
- spec/rubocop/cop/style/hash_syntax_spec.rb
|
518
530
|
- spec/rubocop/cop/style/if_unless_modifier_spec.rb
|
519
531
|
- spec/rubocop/cop/style/if_with_semicolon_spec.rb
|
@@ -535,8 +547,11 @@ files:
|
|
535
547
|
- spec/rubocop/cop/style/multiline_block_chain_spec.rb
|
536
548
|
- spec/rubocop/cop/style/multiline_if_then_spec.rb
|
537
549
|
- spec/rubocop/cop/style/multiline_ternary_operator_spec.rb
|
550
|
+
- spec/rubocop/cop/style/negated_if_spec.rb
|
551
|
+
- spec/rubocop/cop/style/negated_while_spec.rb
|
538
552
|
- spec/rubocop/cop/style/nested_ternary_operator_spec.rb
|
539
553
|
- spec/rubocop/cop/style/nil_comparison_spec.rb
|
554
|
+
- spec/rubocop/cop/style/non_nil_check_spec.rb
|
540
555
|
- spec/rubocop/cop/style/not_spec.rb
|
541
556
|
- spec/rubocop/cop/style/numeric_literals_spec.rb
|
542
557
|
- spec/rubocop/cop/style/one_line_conditional_spec.rb
|
@@ -559,6 +574,7 @@ files:
|
|
559
574
|
- spec/rubocop/cop/style/signal_exception_spec.rb
|
560
575
|
- spec/rubocop/cop/style/single_line_block_params_spec.rb
|
561
576
|
- spec/rubocop/cop/style/single_line_methods_spec.rb
|
577
|
+
- spec/rubocop/cop/style/single_space_before_first_arg_spec.rb
|
562
578
|
- spec/rubocop/cop/style/space_after_colon_spec.rb
|
563
579
|
- spec/rubocop/cop/style/space_after_comma_spec.rb
|
564
580
|
- spec/rubocop/cop/style/space_after_control_keyword_spec.rb
|
@@ -601,6 +617,7 @@ files:
|
|
601
617
|
- spec/rubocop/formatter/clang_style_formatter_spec.rb
|
602
618
|
- spec/rubocop/formatter/colorizable_spec.rb
|
603
619
|
- spec/rubocop/formatter/disabled_config_formatter_spec.rb
|
620
|
+
- spec/rubocop/formatter/disabled_lines_formatter_spec.rb
|
604
621
|
- spec/rubocop/formatter/emacs_style_formatter_spec.rb
|
605
622
|
- spec/rubocop/formatter/file_list_formatter_spec.rb
|
606
623
|
- spec/rubocop/formatter/formatter_set_spec.rb
|
@@ -633,17 +650,17 @@ require_paths:
|
|
633
650
|
- lib
|
634
651
|
required_ruby_version: !ruby/object:Gem::Requirement
|
635
652
|
requirements:
|
636
|
-
- -
|
653
|
+
- - ">="
|
637
654
|
- !ruby/object:Gem::Version
|
638
655
|
version: 1.9.2
|
639
656
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
640
657
|
requirements:
|
641
|
-
- -
|
658
|
+
- - ">="
|
642
659
|
- !ruby/object:Gem::Version
|
643
660
|
version: '0'
|
644
661
|
requirements: []
|
645
662
|
rubyforge_project:
|
646
|
-
rubygems_version: 2.
|
663
|
+
rubygems_version: 2.2.2
|
647
664
|
signing_key:
|
648
665
|
specification_version: 4
|
649
666
|
summary: Automatic Ruby code style checking tool.
|
@@ -668,6 +685,7 @@ test_files:
|
|
668
685
|
- spec/rubocop/cop/lint/deprecated_class_methods_spec.rb
|
669
686
|
- spec/rubocop/cop/lint/else_layout_spec.rb
|
670
687
|
- spec/rubocop/cop/lint/empty_ensure_spec.rb
|
688
|
+
- spec/rubocop/cop/lint/empty_interpolation_spec.rb
|
671
689
|
- spec/rubocop/cop/lint/end_alignment_spec.rb
|
672
690
|
- spec/rubocop/cop/lint/end_in_method_spec.rb
|
673
691
|
- spec/rubocop/cop/lint/ensure_return_spec.rb
|
@@ -681,9 +699,11 @@ test_files:
|
|
681
699
|
- spec/rubocop/cop/lint/require_parentheses_spec.rb
|
682
700
|
- spec/rubocop/cop/lint/rescue_exception_spec.rb
|
683
701
|
- spec/rubocop/cop/lint/shadowing_outer_local_variable_spec.rb
|
702
|
+
- spec/rubocop/cop/lint/space_before_first_arg_spec.rb
|
684
703
|
- spec/rubocop/cop/lint/string_conversion_in_interpolation_spec.rb
|
685
704
|
- spec/rubocop/cop/lint/syntax_spec.rb
|
686
705
|
- spec/rubocop/cop/lint/unreachable_code_spec.rb
|
706
|
+
- spec/rubocop/cop/lint/useless_access_modifier_spec.rb
|
687
707
|
- spec/rubocop/cop/lint/useless_assignment_spec.rb
|
688
708
|
- spec/rubocop/cop/lint/useless_comparison_spec.rb
|
689
709
|
- spec/rubocop/cop/lint/useless_else_without_rescue_spec.rb
|
@@ -694,9 +714,10 @@ test_files:
|
|
694
714
|
- spec/rubocop/cop/rails/default_scope_spec.rb
|
695
715
|
- spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb
|
696
716
|
- spec/rubocop/cop/rails/output_spec.rb
|
697
|
-
- spec/rubocop/cop/rails/
|
717
|
+
- spec/rubocop/cop/rails/read_write_attribute_spec.rb
|
698
718
|
- spec/rubocop/cop/rails/scope_args_spec.rb
|
699
719
|
- spec/rubocop/cop/rails/validation_spec.rb
|
720
|
+
- spec/rubocop/cop/severity_spec.rb
|
700
721
|
- spec/rubocop/cop/style/access_modifier_indentation_spec.rb
|
701
722
|
- spec/rubocop/cop/style/accessor_method_name_spec.rb
|
702
723
|
- spec/rubocop/cop/style/alias_spec.rb
|
@@ -704,6 +725,7 @@ test_files:
|
|
704
725
|
- spec/rubocop/cop/style/align_hash_spec.rb
|
705
726
|
- spec/rubocop/cop/style/align_parameters_spec.rb
|
706
727
|
- spec/rubocop/cop/style/and_or_spec.rb
|
728
|
+
- spec/rubocop/cop/style/array_join_spec.rb
|
707
729
|
- spec/rubocop/cop/style/ascii_comments_spec.rb
|
708
730
|
- spec/rubocop/cop/style/ascii_identifiers_spec.rb
|
709
731
|
- spec/rubocop/cop/style/attr_spec.rb
|
@@ -726,6 +748,7 @@ test_files:
|
|
726
748
|
- spec/rubocop/cop/style/constant_name_spec.rb
|
727
749
|
- spec/rubocop/cop/style/cyclomatic_complexity_spec.rb
|
728
750
|
- spec/rubocop/cop/style/def_with_parentheses_spec.rb
|
751
|
+
- spec/rubocop/cop/style/deprecated_hash_methods_spec.rb
|
729
752
|
- spec/rubocop/cop/style/documentation_spec.rb
|
730
753
|
- spec/rubocop/cop/style/dot_position_spec.rb
|
731
754
|
- spec/rubocop/cop/style/double_negation_spec.rb
|
@@ -738,16 +761,13 @@ test_files:
|
|
738
761
|
- spec/rubocop/cop/style/end_block_spec.rb
|
739
762
|
- spec/rubocop/cop/style/end_of_line_spec.rb
|
740
763
|
- spec/rubocop/cop/style/even_odd_spec.rb
|
741
|
-
- spec/rubocop/cop/style/favor_join_spec.rb
|
742
|
-
- spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb
|
743
|
-
- spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb
|
744
764
|
- spec/rubocop/cop/style/file_name_spec.rb
|
745
765
|
- spec/rubocop/cop/style/final_newline_spec.rb
|
746
766
|
- spec/rubocop/cop/style/flip_flop_spec.rb
|
747
767
|
- spec/rubocop/cop/style/for_spec.rb
|
748
768
|
- spec/rubocop/cop/style/format_string_spec.rb
|
749
769
|
- spec/rubocop/cop/style/global_vars_spec.rb
|
750
|
-
- spec/rubocop/cop/style/
|
770
|
+
- spec/rubocop/cop/style/guard_clause_spec.rb
|
751
771
|
- spec/rubocop/cop/style/hash_syntax_spec.rb
|
752
772
|
- spec/rubocop/cop/style/if_unless_modifier_spec.rb
|
753
773
|
- spec/rubocop/cop/style/if_with_semicolon_spec.rb
|
@@ -769,8 +789,11 @@ test_files:
|
|
769
789
|
- spec/rubocop/cop/style/multiline_block_chain_spec.rb
|
770
790
|
- spec/rubocop/cop/style/multiline_if_then_spec.rb
|
771
791
|
- spec/rubocop/cop/style/multiline_ternary_operator_spec.rb
|
792
|
+
- spec/rubocop/cop/style/negated_if_spec.rb
|
793
|
+
- spec/rubocop/cop/style/negated_while_spec.rb
|
772
794
|
- spec/rubocop/cop/style/nested_ternary_operator_spec.rb
|
773
795
|
- spec/rubocop/cop/style/nil_comparison_spec.rb
|
796
|
+
- spec/rubocop/cop/style/non_nil_check_spec.rb
|
774
797
|
- spec/rubocop/cop/style/not_spec.rb
|
775
798
|
- spec/rubocop/cop/style/numeric_literals_spec.rb
|
776
799
|
- spec/rubocop/cop/style/one_line_conditional_spec.rb
|
@@ -793,6 +816,7 @@ test_files:
|
|
793
816
|
- spec/rubocop/cop/style/signal_exception_spec.rb
|
794
817
|
- spec/rubocop/cop/style/single_line_block_params_spec.rb
|
795
818
|
- spec/rubocop/cop/style/single_line_methods_spec.rb
|
819
|
+
- spec/rubocop/cop/style/single_space_before_first_arg_spec.rb
|
796
820
|
- spec/rubocop/cop/style/space_after_colon_spec.rb
|
797
821
|
- spec/rubocop/cop/style/space_after_comma_spec.rb
|
798
822
|
- spec/rubocop/cop/style/space_after_control_keyword_spec.rb
|
@@ -835,6 +859,7 @@ test_files:
|
|
835
859
|
- spec/rubocop/formatter/clang_style_formatter_spec.rb
|
836
860
|
- spec/rubocop/formatter/colorizable_spec.rb
|
837
861
|
- spec/rubocop/formatter/disabled_config_formatter_spec.rb
|
862
|
+
- spec/rubocop/formatter/disabled_lines_formatter_spec.rb
|
838
863
|
- spec/rubocop/formatter/emacs_style_formatter_spec.rb
|
839
864
|
- spec/rubocop/formatter/file_list_formatter_spec.rb
|
840
865
|
- spec/rubocop/formatter/formatter_set_spec.rb
|