rubocop 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rubocop might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +7 -7
- data/.travis.yml +4 -0
- data/CHANGELOG.md +59 -0
- data/README.md +62 -28
- data/config/default.yml +31 -0
- data/config/disabled.yml +1 -1
- data/config/enabled.yml +17 -0
- data/lib/rubocop.rb +4 -0
- data/lib/rubocop/cli.rb +1 -1
- data/lib/rubocop/config.rb +12 -8
- data/lib/rubocop/config_loader.rb +20 -10
- data/lib/rubocop/cop/cop.rb +13 -7
- data/lib/rubocop/cop/corrector.rb +10 -10
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +6 -1
- data/lib/rubocop/cop/lint/block_alignment.rb +9 -2
- data/lib/rubocop/cop/lint/debugger.rb +13 -1
- data/lib/rubocop/cop/lint/duplicate_methods.rb +104 -0
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
- data/lib/rubocop/cop/lint/require_parentheses.rb +3 -3
- data/lib/rubocop/cop/mixin/access_modifier_node.rb +27 -0
- data/lib/rubocop/cop/mixin/on_normal_if_unless.rb +0 -4
- data/lib/rubocop/cop/rails/delegate.rb +4 -5
- data/lib/rubocop/cop/rails/read_write_attribute.rb +33 -0
- data/lib/rubocop/cop/style/access_modifier_indentation.rb +0 -7
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +4 -2
- data/lib/rubocop/cop/style/class_methods.rb +25 -9
- data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +7 -1
- data/lib/rubocop/cop/style/empty_literal.rb +25 -10
- data/lib/rubocop/cop/style/even_odd.rb +32 -14
- data/lib/rubocop/cop/style/first_parameter_indentation.rb +106 -0
- data/lib/rubocop/cop/style/format_string.rb +2 -2
- data/lib/rubocop/cop/style/global_vars.rb +1 -5
- data/lib/rubocop/cop/style/hash_syntax.rb +0 -4
- data/lib/rubocop/cop/style/indentation_consistency.rb +5 -5
- data/lib/rubocop/cop/style/indentation_width.rb +13 -14
- data/lib/rubocop/cop/style/lambda.rb +48 -2
- data/lib/rubocop/cop/style/line_end_concatenation.rb +43 -47
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +3 -3
- data/lib/rubocop/cop/style/module_function.rb +3 -3
- data/lib/rubocop/cop/style/multiline_block_layout.rb +65 -17
- data/lib/rubocop/cop/style/multiline_operation_indentation.rb +2 -1
- data/lib/rubocop/cop/style/perl_backrefs.rb +2 -2
- data/lib/rubocop/cop/style/redundant_exception.rb +12 -0
- data/lib/rubocop/cop/style/self_assignment.rb +27 -0
- data/lib/rubocop/cop/style/semicolon.rb +2 -1
- data/lib/rubocop/cop/style/space_around_block_parameters.rb +92 -0
- data/lib/rubocop/cop/style/string_literals_in_interpolation.rb +0 -8
- data/lib/rubocop/cop/style/struct_inheritance.rb +42 -0
- data/lib/rubocop/cop/style/trivial_accessors.rb +10 -4
- data/lib/rubocop/cop/util.rb +32 -7
- data/lib/rubocop/formatter/simple_text_formatter.rb +0 -15
- data/lib/rubocop/options.rb +28 -41
- data/lib/rubocop/processed_source.rb +6 -0
- data/lib/rubocop/rake_task.rb +6 -3
- data/lib/rubocop/runner.rb +55 -15
- data/lib/rubocop/version.rb +1 -1
- data/relnotes/v0.29.0.md +116 -0
- data/rubocop.gemspec +3 -3
- data/spec/rubocop/cli_spec.rb +329 -25
- data/spec/rubocop/config_loader_spec.rb +20 -0
- data/spec/rubocop/cop/lint/assignment_in_condition_spec.rb +27 -3
- data/spec/rubocop/cop/lint/block_alignment_spec.rb +3 -4
- data/spec/rubocop/cop/lint/condition_position_spec.rb +1 -1
- data/spec/rubocop/cop/lint/debugger_spec.rb +20 -7
- data/spec/rubocop/cop/lint/duplicate_methods_spec.rb +189 -0
- data/spec/rubocop/cop/lint/empty_interpolation_spec.rb +1 -1
- data/spec/rubocop/cop/lint/end_in_method_spec.rb +1 -1
- data/spec/rubocop/cop/lint/eval_spec.rb +4 -4
- data/spec/rubocop/cop/lint/literal_in_condition_spec.rb +18 -0
- data/spec/rubocop/cop/lint/literal_in_interpolation_spec.rb +2 -2
- data/spec/rubocop/cop/lint/loop_spec.rb +4 -4
- data/spec/rubocop/cop/lint/parentheses_as_grouped_expression_spec.rb +7 -7
- data/spec/rubocop/cop/lint/space_before_first_arg_spec.rb +5 -4
- data/spec/rubocop/cop/lint/useless_assignment_spec.rb +3 -9
- data/spec/rubocop/cop/lint/useless_comparison_spec.rb +1 -1
- data/spec/rubocop/cop/lint/void_spec.rb +1 -1
- data/spec/rubocop/cop/metrics/abc_size_spec.rb +10 -0
- data/spec/rubocop/cop/metrics/line_length_spec.rb +2 -2
- data/spec/rubocop/cop/metrics/parameter_lists_spec.rb +2 -2
- data/spec/rubocop/cop/rails/action_filter_spec.rb +6 -12
- data/spec/rubocop/cop/rails/default_scope_spec.rb +5 -5
- data/spec/rubocop/cop/rails/delegate_spec.rb +8 -0
- data/spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb +1 -1
- data/spec/rubocop/cop/rails/read_write_attribute_spec.rb +119 -8
- data/spec/rubocop/cop/rails/scope_args_spec.rb +3 -3
- data/spec/rubocop/cop/rails/validation_spec.rb +3 -3
- data/spec/rubocop/cop/style/alias_spec.rb +5 -5
- data/spec/rubocop/cop/style/align_hash_spec.rb +1 -1
- data/spec/rubocop/cop/style/align_parameters_spec.rb +8 -8
- data/spec/rubocop/cop/style/and_or_spec.rb +15 -30
- data/spec/rubocop/cop/style/array_join_spec.rb +4 -4
- data/spec/rubocop/cop/style/ascii_comments_spec.rb +1 -2
- data/spec/rubocop/cop/style/ascii_identifiers_spec.rb +2 -2
- data/spec/rubocop/cop/style/begin_block_spec.rb +1 -1
- data/spec/rubocop/cop/style/block_comments_spec.rb +1 -1
- data/spec/rubocop/cop/style/block_end_newline_spec.rb +1 -1
- data/spec/rubocop/cop/style/blocks_spec.rb +2 -2
- data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +38 -33
- data/spec/rubocop/cop/style/case_equality_spec.rb +1 -1
- data/spec/rubocop/cop/style/character_literal_spec.rb +4 -4
- data/spec/rubocop/cop/style/class_and_module_children_spec.rb +4 -2
- data/spec/rubocop/cop/style/class_methods_spec.rb +12 -0
- data/spec/rubocop/cop/style/class_vars_spec.rb +2 -2
- data/spec/rubocop/cop/style/collection_methods_spec.rb +4 -4
- data/spec/rubocop/cop/style/colon_method_call_spec.rb +8 -8
- data/spec/rubocop/cop/style/comment_annotation_spec.rb +10 -10
- data/spec/rubocop/cop/style/constant_name_spec.rb +7 -7
- data/spec/rubocop/cop/style/def_with_parentheses_spec.rb +1 -1
- data/spec/rubocop/cop/style/deprecated_hash_methods_spec.rb +4 -4
- data/spec/rubocop/cop/style/dot_position_spec.rb +8 -6
- data/spec/rubocop/cop/style/each_with_object_spec.rb +2 -2
- data/spec/rubocop/cop/style/else_alignment_spec.rb +2 -4
- data/spec/rubocop/cop/style/empty_lines_around_access_modifier_spec.rb +78 -0
- data/spec/rubocop/cop/style/empty_lines_around_class_body_spec.rb +60 -0
- data/spec/rubocop/cop/style/empty_lines_spec.rb +3 -3
- data/spec/rubocop/cop/style/empty_literal_spec.rb +29 -12
- data/spec/rubocop/cop/style/encoding_spec.rb +3 -3
- data/spec/rubocop/cop/style/end_block_spec.rb +1 -1
- data/spec/rubocop/cop/style/end_of_line_spec.rb +2 -2
- data/spec/rubocop/cop/style/even_odd_spec.rb +109 -20
- data/spec/rubocop/cop/style/extra_spacing_spec.rb +3 -3
- data/spec/rubocop/cop/style/first_parameter_indentation_spec.rb +293 -0
- data/spec/rubocop/cop/style/for_spec.rb +2 -2
- data/spec/rubocop/cop/style/format_string_spec.rb +45 -21
- data/spec/rubocop/cop/style/global_vars_spec.rb +4 -4
- data/spec/rubocop/cop/style/guard_clause_spec.rb +17 -0
- data/spec/rubocop/cop/style/hash_syntax_spec.rb +15 -15
- data/spec/rubocop/cop/{metrics → style}/if_unless_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/style/if_with_semicolon_spec.rb +2 -2
- data/spec/rubocop/cop/style/indent_array_spec.rb +3 -6
- data/spec/rubocop/cop/style/indent_hash_spec.rb +4 -4
- data/spec/rubocop/cop/style/indentation_consistency_spec.rb +1 -2
- data/spec/rubocop/cop/style/indentation_width_spec.rb +1 -2
- data/spec/rubocop/cop/style/infinite_loop_spec.rb +1 -1
- data/spec/rubocop/cop/style/lambda_call_spec.rb +4 -4
- data/spec/rubocop/cop/style/lambda_spec.rb +37 -2
- data/spec/rubocop/cop/style/leading_comment_space_spec.rb +7 -12
- data/spec/rubocop/cop/style/line_end_concatenation_spec.rb +41 -1
- data/spec/rubocop/cop/style/method_call_parentheses_spec.rb +4 -4
- data/spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb +3 -3
- data/spec/rubocop/cop/style/method_name_spec.rb +1 -1
- data/spec/rubocop/cop/style/multiline_block_layout_spec.rb +61 -0
- data/spec/rubocop/cop/style/multiline_if_then_spec.rb +1 -3
- data/spec/rubocop/cop/style/multiline_operation_indentation_spec.rb +8 -0
- data/spec/rubocop/cop/style/multiline_ternary_operator_spec.rb +1 -1
- data/spec/rubocop/cop/style/nested_ternary_operator_spec.rb +1 -1
- data/spec/rubocop/cop/style/next_spec.rb +16 -0
- data/spec/rubocop/cop/style/numeric_literals_spec.rb +5 -5
- data/spec/rubocop/cop/style/one_line_conditional_spec.rb +1 -1
- data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +22 -4
- data/spec/rubocop/cop/style/percent_literal_delimiters_spec.rb +31 -31
- data/spec/rubocop/cop/style/percent_q_literals_spec.rb +12 -12
- data/spec/rubocop/cop/style/perl_backrefs_spec.rb +3 -3
- data/spec/rubocop/cop/style/proc_spec.rb +3 -3
- data/spec/rubocop/cop/style/raise_args_spec.rb +9 -9
- data/spec/rubocop/cop/style/redundant_begin_spec.rb +1 -1
- data/spec/rubocop/cop/style/redundant_exception_spec.rb +36 -4
- data/spec/rubocop/cop/style/redundant_self_spec.rb +89 -45
- data/spec/rubocop/cop/style/regexp_literal_spec.rb +9 -9
- data/spec/rubocop/cop/style/rescue_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/style/self_assignment_spec.rb +16 -10
- data/spec/rubocop/cop/style/semicolon_spec.rb +9 -9
- data/spec/rubocop/cop/style/single_line_block_params_spec.rb +2 -2
- data/spec/rubocop/cop/style/single_space_before_first_arg_spec.rb +1 -1
- data/spec/rubocop/cop/style/space_after_colon_spec.rb +5 -5
- data/spec/rubocop/cop/style/space_after_comma_spec.rb +3 -3
- data/spec/rubocop/cop/style/space_after_control_keyword_spec.rb +4 -4
- data/spec/rubocop/cop/style/space_after_not_spec.rb +2 -2
- data/spec/rubocop/cop/style/space_after_semicolon_spec.rb +2 -2
- data/spec/rubocop/cop/style/space_around_block_parameters_spec.rb +150 -0
- data/spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb +18 -9
- data/spec/rubocop/cop/style/space_around_operators_spec.rb +24 -21
- data/spec/rubocop/cop/style/space_before_block_braces_spec.rb +4 -4
- data/spec/rubocop/cop/style/space_before_comma_spec.rb +4 -4
- data/spec/rubocop/cop/style/space_before_comment_spec.rb +3 -3
- data/spec/rubocop/cop/style/space_before_semicolon_spec.rb +2 -2
- data/spec/rubocop/cop/style/space_inside_block_braces_spec.rb +33 -24
- data/spec/rubocop/cop/style/space_inside_brackets_spec.rb +2 -2
- data/spec/rubocop/cop/style/space_inside_hash_literal_braces_spec.rb +9 -9
- data/spec/rubocop/cop/style/space_inside_parens_spec.rb +1 -1
- data/spec/rubocop/cop/style/special_global_vars_spec.rb +6 -6
- data/spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb +3 -3
- data/spec/rubocop/cop/style/string_literals_spec.rb +16 -16
- data/spec/rubocop/cop/style/struct_inheritance_spec.rb +44 -0
- data/spec/rubocop/cop/style/symbol_array_spec.rb +9 -9
- data/spec/rubocop/cop/style/symbol_proc_spec.rb +12 -12
- data/spec/rubocop/cop/style/tab_spec.rb +4 -4
- data/spec/rubocop/cop/style/trailing_blank_lines_spec.rb +2 -2
- data/spec/rubocop/cop/style/trailing_whitespace_spec.rb +2 -2
- data/spec/rubocop/cop/style/trivial_accessors_spec.rb +16 -0
- data/spec/rubocop/cop/style/unneeded_capital_w_spec.rb +11 -22
- data/spec/rubocop/cop/style/variable_interpolation_spec.rb +7 -7
- data/spec/rubocop/cop/style/while_until_do_spec.rb +2 -2
- data/spec/rubocop/cop/{metrics → style}/while_until_modifier_spec.rb +2 -2
- data/spec/rubocop/cop/style/word_array_spec.rb +11 -11
- data/spec/rubocop/cop/util_spec.rb +51 -0
- data/spec/rubocop/cop/variable_force/reference_spec.rb +19 -0
- data/spec/rubocop/cop/variable_force/variable_table_spec.rb +7 -0
- data/spec/rubocop/formatter/disabled_lines_formatter_spec.rb +7 -8
- data/spec/rubocop/formatter/text_util_spec.rb +55 -0
- data/spec/rubocop/options_spec.rb +26 -20
- data/spec/rubocop/rake_task_spec.rb +122 -0
- data/spec/rubocop/runner_spec.rb +37 -2
- data/spec/rubocop/token_spec.rb +5 -1
- data/spec/spec_helper.rb +5 -2
- data/spec/support/cop_helper.rb +3 -0
- data/spec/support/cops/class_must_be_a_module_cop.rb +19 -0
- data/spec/support/cops/module_must_be_a_class_cop.rb +19 -0
- data/spec/support/custom_matchers.rb +1 -1
- metadata +35 -12
@@ -26,7 +26,7 @@ module RuboCop
|
|
26
26
|
let(:cop_disabled_line_ranges) { {} }
|
27
27
|
it 'does not add to cop_disabled_line_ranges' do
|
28
28
|
expect { file_started }.to_not(
|
29
|
-
|
29
|
+
change { formatter.cop_disabled_line_ranges })
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -36,7 +36,7 @@ module RuboCop
|
|
36
36
|
end
|
37
37
|
it 'merges the changes into cop_disabled_line_ranges' do
|
38
38
|
expect { file_started }.to(
|
39
|
-
|
39
|
+
change { formatter.cop_disabled_line_ranges })
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -54,12 +54,11 @@ module RuboCop
|
|
54
54
|
|
55
55
|
it 'lists disabled cops by file' do
|
56
56
|
formatter.finished(files)
|
57
|
-
expect(output.string).to eq(
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
''].join("\n"))
|
57
|
+
expect(output.string).to eq(['',
|
58
|
+
'Cops disabled line ranges:',
|
59
|
+
'',
|
60
|
+
'lib/rubocop.rb:1..1: LineLength',
|
61
|
+
''].join("\n"))
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Formatter
|
7
|
+
describe TextUtil do
|
8
|
+
subject(:text_util) { RuboCop::Formatter::TextUtil }
|
9
|
+
|
10
|
+
describe 'pluralize' do
|
11
|
+
it 'will not change 0 to no' do
|
12
|
+
pluralized_text = text_util.pluralize(0, 'file')
|
13
|
+
|
14
|
+
expect(pluralized_text).to eq('0 files')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'will change 0 to no when configured' do
|
18
|
+
pluralized_text = text_util.pluralize(0, 'file', no_for_zero: true)
|
19
|
+
|
20
|
+
expect(pluralized_text).to eq('no files')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'will not pluralize 1' do
|
24
|
+
pluralized_text = text_util.pluralize(1, 'file')
|
25
|
+
|
26
|
+
expect(pluralized_text).to eq('1 file')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'will pluralize quantities greater than 1' do
|
30
|
+
pluralized_text = text_util.pluralize(3, 'file')
|
31
|
+
|
32
|
+
expect(pluralized_text).to eq('3 files')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'will pluralize fractions' do
|
36
|
+
pluralized_text = text_util.pluralize(0.5, 'file')
|
37
|
+
|
38
|
+
expect(pluralized_text).to eq('0.5 files')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'will pluralize -1' do
|
42
|
+
pluralized_text = text_util.pluralize(-1, 'file')
|
43
|
+
|
44
|
+
expect(pluralized_text).to eq('-1 files')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'will pluralize negative quantities less than -1' do
|
48
|
+
pluralized_text = text_util.pluralize(-2, 'file')
|
49
|
+
|
50
|
+
expect(pluralized_text).to eq('-2 files')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -36,6 +36,7 @@ describe RuboCop::Options, :isolated_environment do
|
|
36
36
|
|
37
37
|
expected_help = <<-END
|
38
38
|
Usage: rubocop [options] [file1, file2, ...]
|
39
|
+
--except [COP1,COP2,...] Disable the given cop(s).
|
39
40
|
--only [COP1,COP2,...] Run only the given cop(s).
|
40
41
|
--only-guide-cops Run only cops for rules that link to a
|
41
42
|
style guide.
|
@@ -64,7 +65,8 @@ Usage: rubocop [options] [file1, file2, ...]
|
|
64
65
|
specified --format, or the default format
|
65
66
|
if no format is specified.
|
66
67
|
-r, --require FILE Require Ruby file.
|
67
|
-
--fail-level SEVERITY Minimum severity for exit
|
68
|
+
--fail-level SEVERITY Minimum severity (A/R/C/W/E/F) for exit
|
69
|
+
with error code.
|
68
70
|
--show-cops [COP1,COP2,...] Shows the given cops, or all cops by
|
69
71
|
default, and their configurations for the
|
70
72
|
current directory.
|
@@ -137,6 +139,29 @@ Usage: rubocop [options] [file1, file2, ...]
|
|
137
139
|
end
|
138
140
|
end
|
139
141
|
|
142
|
+
describe '--fail-level' do
|
143
|
+
it 'accepts full severity names' do
|
144
|
+
%w(refactor convention warning error fatal).each do |severity|
|
145
|
+
expect { options.parse(['--fail-level', severity]) }
|
146
|
+
.not_to raise_error
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'accepts severity initial letters' do
|
151
|
+
%w(R C W E F).each do |severity|
|
152
|
+
expect { options.parse(['--fail-level', severity]) }
|
153
|
+
.not_to raise_error
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'accepts the "fake" severities A/autocorrect' do
|
158
|
+
%w(autocorrect A).each do |severity|
|
159
|
+
expect { options.parse(['--fail-level', severity]) }
|
160
|
+
.not_to raise_error
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
140
165
|
describe '--require' do
|
141
166
|
let(:required_file_path) { './path/to/required_file.rb' }
|
142
167
|
|
@@ -153,23 +178,4 @@ Usage: rubocop [options] [file1, file2, ...]
|
|
153
178
|
end
|
154
179
|
end
|
155
180
|
end
|
156
|
-
|
157
|
-
unless RuboCop::Version::STRING.start_with?('0')
|
158
|
-
describe '-e/--emacs option' do
|
159
|
-
it 'is dropped in RuboCop 1.0.0' do
|
160
|
-
# This spec can be removed once the option is dropped.
|
161
|
-
expect { options.parse(['--emacs']) }
|
162
|
-
.to raise_error(OptionParser::InvalidOption)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe '-s/--silent option' do
|
167
|
-
it 'raises error in RuboCop 1.0.0' do
|
168
|
-
# This spec can be removed
|
169
|
-
# once Options#ignore_dropped_options is removed.
|
170
|
-
expect { options.parse(['--silent']) }
|
171
|
-
.to raise_error(OptionParser::InvalidOption)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
181
|
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'rubocop/rake_task'
|
5
|
+
|
6
|
+
describe RuboCop::RakeTask do
|
7
|
+
describe 'defining tasks' do
|
8
|
+
it 'creates a rubocop task' do
|
9
|
+
RuboCop::RakeTask.new
|
10
|
+
|
11
|
+
expect(Rake::Task.task_defined?(:rubocop)).to be true
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'creates a rubocop:auto_correct task' do
|
15
|
+
RuboCop::RakeTask.new
|
16
|
+
|
17
|
+
expect(Rake::Task.task_defined?('rubocop:auto_correct')).to be true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'creates a named task' do
|
21
|
+
RuboCop::RakeTask.new(:lint_lib)
|
22
|
+
|
23
|
+
expect(Rake::Task.task_defined?(:lint_lib)).to be true
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'creates an auto_correct task for the named task' do
|
27
|
+
RuboCop::RakeTask.new(:lint_lib)
|
28
|
+
|
29
|
+
expect(Rake::Task.task_defined?('lint_lib:auto_correct')).to be true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'running tasks' do
|
34
|
+
before(:each) do
|
35
|
+
$stdout = StringIO.new
|
36
|
+
$stderr = StringIO.new
|
37
|
+
Rake::Task['rubocop'].clear if Rake::Task.task_defined?('rubocop')
|
38
|
+
end
|
39
|
+
|
40
|
+
after(:each) do
|
41
|
+
$stdout = STDOUT
|
42
|
+
$stderr = STDERR
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'runs with default options' do
|
46
|
+
RuboCop::RakeTask.new
|
47
|
+
|
48
|
+
cli = double('cli', run: 0)
|
49
|
+
allow(RuboCop::CLI).to receive(:new) { cli }
|
50
|
+
expect(cli).to receive(:run).with(['--format', 'progress'])
|
51
|
+
|
52
|
+
Rake::Task['rubocop'].execute
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'runs with specified options if a block is given' do
|
56
|
+
RuboCop::RakeTask.new do |task|
|
57
|
+
task.patterns = ['lib/**/*.rb']
|
58
|
+
task.formatters = ['files']
|
59
|
+
task.fail_on_error = false
|
60
|
+
task.options = ['--display-cop-names']
|
61
|
+
task.verbose = false
|
62
|
+
end
|
63
|
+
|
64
|
+
cli = double('cli', run: 0)
|
65
|
+
allow(RuboCop::CLI).to receive(:new) { cli }
|
66
|
+
options = ['--format', 'files', '--display-cop-names', 'lib/**/*.rb']
|
67
|
+
expect(cli).to receive(:run).with(options)
|
68
|
+
|
69
|
+
Rake::Task['rubocop'].execute
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'will not error when result is not 0 and fail_on_error is false' do
|
73
|
+
RuboCop::RakeTask.new do |task|
|
74
|
+
task.fail_on_error = false
|
75
|
+
end
|
76
|
+
|
77
|
+
cli = double('cli', run: 1)
|
78
|
+
allow(RuboCop::CLI).to receive(:new) { cli }
|
79
|
+
|
80
|
+
expect { Rake::Task['rubocop'].execute }.to_not raise_error
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'exits when result is not 0 and fail_on_error is true' do
|
84
|
+
RuboCop::RakeTask.new
|
85
|
+
|
86
|
+
cli = double('cli', run: 1)
|
87
|
+
allow(RuboCop::CLI).to receive(:new) { cli }
|
88
|
+
|
89
|
+
expect { Rake::Task['rubocop'].execute }.to raise_error(SystemExit)
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'auto_correct' do
|
93
|
+
it 'runs with --auto-correct' do
|
94
|
+
RuboCop::RakeTask.new
|
95
|
+
|
96
|
+
cli = double('cli', run: 0)
|
97
|
+
allow(RuboCop::CLI).to receive(:new) { cli }
|
98
|
+
options = ['--auto-correct', '--format', 'progress']
|
99
|
+
expect(cli).to receive(:run).with(options)
|
100
|
+
|
101
|
+
Rake::Task['rubocop:auto_correct'].execute
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'runs with with the options that were passed to its parent task' do
|
105
|
+
RuboCop::RakeTask.new do |task|
|
106
|
+
task.patterns = ['lib/**/*.rb']
|
107
|
+
task.formatters = ['files']
|
108
|
+
task.fail_on_error = false
|
109
|
+
task.options = ['-D']
|
110
|
+
task.verbose = false
|
111
|
+
end
|
112
|
+
|
113
|
+
cli = double('cli', run: 0)
|
114
|
+
allow(RuboCop::CLI).to receive(:new) { cli }
|
115
|
+
options = ['--auto-correct', '--format', 'files', '-D', 'lib/**/*.rb']
|
116
|
+
expect(cli).to receive(:run).with(options)
|
117
|
+
|
118
|
+
Rake::Task['rubocop:auto_correct'].execute
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
data/spec/rubocop/runner_spec.rb
CHANGED
@@ -11,8 +11,6 @@ end
|
|
11
11
|
describe RuboCop::Runner, :isolated_environment do
|
12
12
|
include FileHelper
|
13
13
|
|
14
|
-
subject(:runner) { described_class.new(options, RuboCop::ConfigStore.new) }
|
15
|
-
let(:options) { { formatters: [['progress', formatter_output_path]] } }
|
16
14
|
let(:formatter_output_path) { 'formatter_output.txt' }
|
17
15
|
let(:formatter_output) { File.read(formatter_output_path) }
|
18
16
|
|
@@ -21,6 +19,8 @@ describe RuboCop::Runner, :isolated_environment do
|
|
21
19
|
end
|
22
20
|
|
23
21
|
describe '#run' do
|
22
|
+
let(:options) { { formatters: [['progress', formatter_output_path]] } }
|
23
|
+
subject(:runner) { described_class.new(options, RuboCop::ConfigStore.new) }
|
24
24
|
context 'if there are no offenses in inspected files' do
|
25
25
|
let(:source) { <<-END.strip_indent }
|
26
26
|
# coding: utf-8
|
@@ -61,4 +61,39 @@ describe RuboCop::Runner, :isolated_environment do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
describe '#run with cops autocorrecting each-other' do
|
66
|
+
let(:options) do
|
67
|
+
{
|
68
|
+
auto_correct: true,
|
69
|
+
formatters: [['progress', formatter_output_path]]
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
subject(:runner) do
|
74
|
+
runner_class = Class.new(RuboCop::Runner) do
|
75
|
+
def mobilized_cop_classes(_config)
|
76
|
+
[
|
77
|
+
RuboCop::Cop::Test::ClassMustBeAModuleCop,
|
78
|
+
RuboCop::Cop::Test::ModuleMustBeAClassCop
|
79
|
+
]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
runner_class.new(options, RuboCop::ConfigStore.new)
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'if there is an offense in an inspected file' do
|
86
|
+
let(:source) { <<-END.strip_indent }
|
87
|
+
# coding: utf-8
|
88
|
+
class Klass
|
89
|
+
end
|
90
|
+
END
|
91
|
+
|
92
|
+
it 'aborts because of an infinite loop' do
|
93
|
+
expect do
|
94
|
+
runner.run([])
|
95
|
+
end.to raise_error RuboCop::Runner::InfiniteCorrectionLoop
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
64
99
|
end
|
data/spec/rubocop/token_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe RuboCop::Token do
|
|
8
8
|
let(:parser_token) { [type, [text, range]] }
|
9
9
|
let(:type) { :kDEF }
|
10
10
|
let(:text) { 'def' }
|
11
|
-
let(:range) { double('range') }
|
11
|
+
let(:range) { double('range', line: 42, column: 30) }
|
12
12
|
|
13
13
|
it "sets parser token's type to rubocop token's type" do
|
14
14
|
expect(token.type).to eq(type)
|
@@ -21,5 +21,9 @@ describe RuboCop::Token do
|
|
21
21
|
it "sets parser token's range to rubocop token's pos" do
|
22
22
|
expect(token.pos).to eq(range)
|
23
23
|
end
|
24
|
+
|
25
|
+
it 'returns a #to_s useful for debugging' do
|
26
|
+
expect(token.to_s).to eq('[[42, 30], kDEF, "def"]')
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
# Coverage support needs to be required *before* the RuboCop code is required!
|
4
|
+
require 'support/coverage'
|
5
|
+
|
6
|
+
require 'rubocop'
|
7
|
+
|
3
8
|
# Requires supporting files with custom matchers and macros, etc,
|
4
9
|
# in ./support/ and its subdirectories.
|
5
10
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
6
11
|
|
7
|
-
require 'rubocop'
|
8
|
-
|
9
12
|
RSpec.configure do |config|
|
10
13
|
# These two settings work together to allow you to limit a spec run
|
11
14
|
# to individual examples or groups you care about by tagging them with
|
data/spec/support/cop_helper.rb
CHANGED
@@ -8,6 +8,9 @@ module CopHelper
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def inspect_source(cop, source, file = nil)
|
11
|
+
if source.is_a?(Array) && source.size == 1
|
12
|
+
fail "Don't use an array for a single line of code: #{source}"
|
13
|
+
end
|
11
14
|
RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
|
12
15
|
processed_source = parse_source(source, file)
|
13
16
|
fail 'Error parsing example code' unless processed_source.valid_syntax?
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Test
|
6
|
+
class ClassMustBeAModuleCop < RuboCop::Cop::Cop
|
7
|
+
def on_class(node)
|
8
|
+
add_offense(node, :expression, 'Class must be a Module')
|
9
|
+
end
|
10
|
+
|
11
|
+
def autocorrect(node)
|
12
|
+
@corrections << lambda do |corrector|
|
13
|
+
corrector.replace(node.loc.keyword, 'module')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Test
|
6
|
+
class ModuleMustBeAClassCop < RuboCop::Cop::Cop
|
7
|
+
def on_module(node)
|
8
|
+
add_offense(node, :expression, 'Module must be a Class')
|
9
|
+
end
|
10
|
+
|
11
|
+
def autocorrect(node)
|
12
|
+
@corrections << lambda do |corrector|
|
13
|
+
corrector.replace(node.loc.keyword, 'class')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
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.29.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:
|
13
|
+
date: 2015-02-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rainbow
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 2.2.0.
|
41
|
+
version: 2.2.0.1
|
42
42
|
- - "<"
|
43
43
|
- !ruby/object:Gem::Version
|
44
44
|
version: '3.0'
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: 2.2.0.
|
51
|
+
version: 2.2.0.1
|
52
52
|
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: '0.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: '0.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: astrolabe
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.1.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.1.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: yard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- lib/rubocop/cop/lint/debugger.rb
|
213
213
|
- lib/rubocop/cop/lint/def_end_alignment.rb
|
214
214
|
- lib/rubocop/cop/lint/deprecated_class_methods.rb
|
215
|
+
- lib/rubocop/cop/lint/duplicate_methods.rb
|
215
216
|
- lib/rubocop/cop/lint/else_layout.rb
|
216
217
|
- lib/rubocop/cop/lint/empty_ensure.rb
|
217
218
|
- lib/rubocop/cop/lint/empty_interpolation.rb
|
@@ -339,6 +340,7 @@ files:
|
|
339
340
|
- lib/rubocop/cop/style/even_odd.rb
|
340
341
|
- lib/rubocop/cop/style/extra_spacing.rb
|
341
342
|
- lib/rubocop/cop/style/file_name.rb
|
343
|
+
- lib/rubocop/cop/style/first_parameter_indentation.rb
|
342
344
|
- lib/rubocop/cop/style/flip_flop.rb
|
343
345
|
- lib/rubocop/cop/style/for.rb
|
344
346
|
- lib/rubocop/cop/style/format_string.rb
|
@@ -402,6 +404,7 @@ files:
|
|
402
404
|
- lib/rubocop/cop/style/space_after_method_name.rb
|
403
405
|
- lib/rubocop/cop/style/space_after_not.rb
|
404
406
|
- lib/rubocop/cop/style/space_after_semicolon.rb
|
407
|
+
- lib/rubocop/cop/style/space_around_block_parameters.rb
|
405
408
|
- lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb
|
406
409
|
- lib/rubocop/cop/style/space_around_operators.rb
|
407
410
|
- lib/rubocop/cop/style/space_before_block_braces.rb
|
@@ -417,6 +420,7 @@ files:
|
|
417
420
|
- lib/rubocop/cop/style/special_global_vars.rb
|
418
421
|
- lib/rubocop/cop/style/string_literals.rb
|
419
422
|
- lib/rubocop/cop/style/string_literals_in_interpolation.rb
|
423
|
+
- lib/rubocop/cop/style/struct_inheritance.rb
|
420
424
|
- lib/rubocop/cop/style/symbol_array.rb
|
421
425
|
- lib/rubocop/cop/style/symbol_proc.rb
|
422
426
|
- lib/rubocop/cop/style/tab.rb
|
@@ -486,6 +490,7 @@ files:
|
|
486
490
|
- relnotes/v0.27.0.md
|
487
491
|
- relnotes/v0.27.1.md
|
488
492
|
- relnotes/v0.28.0.md
|
493
|
+
- relnotes/v0.29.0.md
|
489
494
|
- rubocop.gemspec
|
490
495
|
- spec/.rubocop.yml
|
491
496
|
- spec/fixtures/html_formatter/expected.html
|
@@ -511,6 +516,7 @@ files:
|
|
511
516
|
- spec/rubocop/cop/lint/debugger_spec.rb
|
512
517
|
- spec/rubocop/cop/lint/def_end_alignment_spec.rb
|
513
518
|
- spec/rubocop/cop/lint/deprecated_class_methods_spec.rb
|
519
|
+
- spec/rubocop/cop/lint/duplicate_methods_spec.rb
|
514
520
|
- spec/rubocop/cop/lint/else_layout_spec.rb
|
515
521
|
- spec/rubocop/cop/lint/empty_ensure_spec.rb
|
516
522
|
- spec/rubocop/cop/lint/empty_interpolation_spec.rb
|
@@ -544,12 +550,10 @@ files:
|
|
544
550
|
- spec/rubocop/cop/metrics/block_nesting_spec.rb
|
545
551
|
- spec/rubocop/cop/metrics/class_length_spec.rb
|
546
552
|
- spec/rubocop/cop/metrics/cyclomatic_complexity_spec.rb
|
547
|
-
- spec/rubocop/cop/metrics/if_unless_modifier_spec.rb
|
548
553
|
- spec/rubocop/cop/metrics/line_length_spec.rb
|
549
554
|
- spec/rubocop/cop/metrics/method_length_spec.rb
|
550
555
|
- spec/rubocop/cop/metrics/parameter_lists_spec.rb
|
551
556
|
- spec/rubocop/cop/metrics/perceived_complexity_spec.rb
|
552
|
-
- spec/rubocop/cop/metrics/while_until_modifier_spec.rb
|
553
557
|
- spec/rubocop/cop/offense_spec.rb
|
554
558
|
- spec/rubocop/cop/rails/action_filter_spec.rb
|
555
559
|
- spec/rubocop/cop/rails/default_scope_spec.rb
|
@@ -612,12 +616,14 @@ files:
|
|
612
616
|
- spec/rubocop/cop/style/even_odd_spec.rb
|
613
617
|
- spec/rubocop/cop/style/extra_spacing_spec.rb
|
614
618
|
- spec/rubocop/cop/style/file_name_spec.rb
|
619
|
+
- spec/rubocop/cop/style/first_parameter_indentation_spec.rb
|
615
620
|
- spec/rubocop/cop/style/flip_flop_spec.rb
|
616
621
|
- spec/rubocop/cop/style/for_spec.rb
|
617
622
|
- spec/rubocop/cop/style/format_string_spec.rb
|
618
623
|
- spec/rubocop/cop/style/global_vars_spec.rb
|
619
624
|
- spec/rubocop/cop/style/guard_clause_spec.rb
|
620
625
|
- spec/rubocop/cop/style/hash_syntax_spec.rb
|
626
|
+
- spec/rubocop/cop/style/if_unless_modifier_spec.rb
|
621
627
|
- spec/rubocop/cop/style/if_with_semicolon_spec.rb
|
622
628
|
- spec/rubocop/cop/style/indent_array_spec.rb
|
623
629
|
- spec/rubocop/cop/style/indent_hash_spec.rb
|
@@ -674,6 +680,7 @@ files:
|
|
674
680
|
- spec/rubocop/cop/style/space_after_method_name_spec.rb
|
675
681
|
- spec/rubocop/cop/style/space_after_not_spec.rb
|
676
682
|
- spec/rubocop/cop/style/space_after_semicolon_spec.rb
|
683
|
+
- spec/rubocop/cop/style/space_around_block_parameters_spec.rb
|
677
684
|
- spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb
|
678
685
|
- spec/rubocop/cop/style/space_around_operators_spec.rb
|
679
686
|
- spec/rubocop/cop/style/space_before_block_braces_spec.rb
|
@@ -689,6 +696,7 @@ files:
|
|
689
696
|
- spec/rubocop/cop/style/special_global_vars_spec.rb
|
690
697
|
- spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb
|
691
698
|
- spec/rubocop/cop/style/string_literals_spec.rb
|
699
|
+
- spec/rubocop/cop/style/struct_inheritance_spec.rb
|
692
700
|
- spec/rubocop/cop/style/symbol_array_spec.rb
|
693
701
|
- spec/rubocop/cop/style/symbol_proc_spec.rb
|
694
702
|
- spec/rubocop/cop/style/tab_spec.rb
|
@@ -704,11 +712,13 @@ files:
|
|
704
712
|
- spec/rubocop/cop/style/variable_name_spec.rb
|
705
713
|
- spec/rubocop/cop/style/when_then_spec.rb
|
706
714
|
- spec/rubocop/cop/style/while_until_do_spec.rb
|
715
|
+
- spec/rubocop/cop/style/while_until_modifier_spec.rb
|
707
716
|
- spec/rubocop/cop/style/word_array_spec.rb
|
708
717
|
- spec/rubocop/cop/team_spec.rb
|
709
718
|
- spec/rubocop/cop/util_spec.rb
|
710
719
|
- spec/rubocop/cop/variable_force/assignment_spec.rb
|
711
720
|
- spec/rubocop/cop/variable_force/locatable_spec.rb
|
721
|
+
- spec/rubocop/cop/variable_force/reference_spec.rb
|
712
722
|
- spec/rubocop/cop/variable_force/scope_spec.rb
|
713
723
|
- spec/rubocop/cop/variable_force/variable_spec.rb
|
714
724
|
- spec/rubocop/cop/variable_force/variable_table_spec.rb
|
@@ -727,15 +737,19 @@ files:
|
|
727
737
|
- spec/rubocop/formatter/offense_count_formatter_spec.rb
|
728
738
|
- spec/rubocop/formatter/progress_formatter_spec.rb
|
729
739
|
- spec/rubocop/formatter/simple_text_formatter_spec.rb
|
740
|
+
- spec/rubocop/formatter/text_util_spec.rb
|
730
741
|
- spec/rubocop/options_spec.rb
|
731
742
|
- spec/rubocop/path_util_spec.rb
|
732
743
|
- spec/rubocop/processed_source_spec.rb
|
744
|
+
- spec/rubocop/rake_task_spec.rb
|
733
745
|
- spec/rubocop/runner_spec.rb
|
734
746
|
- spec/rubocop/string_util_spec.rb
|
735
747
|
- spec/rubocop/target_finder_spec.rb
|
736
748
|
- spec/rubocop/token_spec.rb
|
737
749
|
- spec/spec_helper.rb
|
738
750
|
- spec/support/cop_helper.rb
|
751
|
+
- spec/support/cops/class_must_be_a_module_cop.rb
|
752
|
+
- spec/support/cops/module_must_be_a_class_cop.rb
|
739
753
|
- spec/support/coverage.rb
|
740
754
|
- spec/support/custom_matchers.rb
|
741
755
|
- spec/support/file_helper.rb
|
@@ -793,6 +807,7 @@ test_files:
|
|
793
807
|
- spec/rubocop/cop/lint/debugger_spec.rb
|
794
808
|
- spec/rubocop/cop/lint/def_end_alignment_spec.rb
|
795
809
|
- spec/rubocop/cop/lint/deprecated_class_methods_spec.rb
|
810
|
+
- spec/rubocop/cop/lint/duplicate_methods_spec.rb
|
796
811
|
- spec/rubocop/cop/lint/else_layout_spec.rb
|
797
812
|
- spec/rubocop/cop/lint/empty_ensure_spec.rb
|
798
813
|
- spec/rubocop/cop/lint/empty_interpolation_spec.rb
|
@@ -826,12 +841,10 @@ test_files:
|
|
826
841
|
- spec/rubocop/cop/metrics/block_nesting_spec.rb
|
827
842
|
- spec/rubocop/cop/metrics/class_length_spec.rb
|
828
843
|
- spec/rubocop/cop/metrics/cyclomatic_complexity_spec.rb
|
829
|
-
- spec/rubocop/cop/metrics/if_unless_modifier_spec.rb
|
830
844
|
- spec/rubocop/cop/metrics/line_length_spec.rb
|
831
845
|
- spec/rubocop/cop/metrics/method_length_spec.rb
|
832
846
|
- spec/rubocop/cop/metrics/parameter_lists_spec.rb
|
833
847
|
- spec/rubocop/cop/metrics/perceived_complexity_spec.rb
|
834
|
-
- spec/rubocop/cop/metrics/while_until_modifier_spec.rb
|
835
848
|
- spec/rubocop/cop/offense_spec.rb
|
836
849
|
- spec/rubocop/cop/rails/action_filter_spec.rb
|
837
850
|
- spec/rubocop/cop/rails/default_scope_spec.rb
|
@@ -894,12 +907,14 @@ test_files:
|
|
894
907
|
- spec/rubocop/cop/style/even_odd_spec.rb
|
895
908
|
- spec/rubocop/cop/style/extra_spacing_spec.rb
|
896
909
|
- spec/rubocop/cop/style/file_name_spec.rb
|
910
|
+
- spec/rubocop/cop/style/first_parameter_indentation_spec.rb
|
897
911
|
- spec/rubocop/cop/style/flip_flop_spec.rb
|
898
912
|
- spec/rubocop/cop/style/for_spec.rb
|
899
913
|
- spec/rubocop/cop/style/format_string_spec.rb
|
900
914
|
- spec/rubocop/cop/style/global_vars_spec.rb
|
901
915
|
- spec/rubocop/cop/style/guard_clause_spec.rb
|
902
916
|
- spec/rubocop/cop/style/hash_syntax_spec.rb
|
917
|
+
- spec/rubocop/cop/style/if_unless_modifier_spec.rb
|
903
918
|
- spec/rubocop/cop/style/if_with_semicolon_spec.rb
|
904
919
|
- spec/rubocop/cop/style/indent_array_spec.rb
|
905
920
|
- spec/rubocop/cop/style/indent_hash_spec.rb
|
@@ -956,6 +971,7 @@ test_files:
|
|
956
971
|
- spec/rubocop/cop/style/space_after_method_name_spec.rb
|
957
972
|
- spec/rubocop/cop/style/space_after_not_spec.rb
|
958
973
|
- spec/rubocop/cop/style/space_after_semicolon_spec.rb
|
974
|
+
- spec/rubocop/cop/style/space_around_block_parameters_spec.rb
|
959
975
|
- spec/rubocop/cop/style/space_around_equals_in_parameter_default_spec.rb
|
960
976
|
- spec/rubocop/cop/style/space_around_operators_spec.rb
|
961
977
|
- spec/rubocop/cop/style/space_before_block_braces_spec.rb
|
@@ -971,6 +987,7 @@ test_files:
|
|
971
987
|
- spec/rubocop/cop/style/special_global_vars_spec.rb
|
972
988
|
- spec/rubocop/cop/style/string_literals_in_interpolation_spec.rb
|
973
989
|
- spec/rubocop/cop/style/string_literals_spec.rb
|
990
|
+
- spec/rubocop/cop/style/struct_inheritance_spec.rb
|
974
991
|
- spec/rubocop/cop/style/symbol_array_spec.rb
|
975
992
|
- spec/rubocop/cop/style/symbol_proc_spec.rb
|
976
993
|
- spec/rubocop/cop/style/tab_spec.rb
|
@@ -986,11 +1003,13 @@ test_files:
|
|
986
1003
|
- spec/rubocop/cop/style/variable_name_spec.rb
|
987
1004
|
- spec/rubocop/cop/style/when_then_spec.rb
|
988
1005
|
- spec/rubocop/cop/style/while_until_do_spec.rb
|
1006
|
+
- spec/rubocop/cop/style/while_until_modifier_spec.rb
|
989
1007
|
- spec/rubocop/cop/style/word_array_spec.rb
|
990
1008
|
- spec/rubocop/cop/team_spec.rb
|
991
1009
|
- spec/rubocop/cop/util_spec.rb
|
992
1010
|
- spec/rubocop/cop/variable_force/assignment_spec.rb
|
993
1011
|
- spec/rubocop/cop/variable_force/locatable_spec.rb
|
1012
|
+
- spec/rubocop/cop/variable_force/reference_spec.rb
|
994
1013
|
- spec/rubocop/cop/variable_force/scope_spec.rb
|
995
1014
|
- spec/rubocop/cop/variable_force/variable_spec.rb
|
996
1015
|
- spec/rubocop/cop/variable_force/variable_table_spec.rb
|
@@ -1009,15 +1028,19 @@ test_files:
|
|
1009
1028
|
- spec/rubocop/formatter/offense_count_formatter_spec.rb
|
1010
1029
|
- spec/rubocop/formatter/progress_formatter_spec.rb
|
1011
1030
|
- spec/rubocop/formatter/simple_text_formatter_spec.rb
|
1031
|
+
- spec/rubocop/formatter/text_util_spec.rb
|
1012
1032
|
- spec/rubocop/options_spec.rb
|
1013
1033
|
- spec/rubocop/path_util_spec.rb
|
1014
1034
|
- spec/rubocop/processed_source_spec.rb
|
1035
|
+
- spec/rubocop/rake_task_spec.rb
|
1015
1036
|
- spec/rubocop/runner_spec.rb
|
1016
1037
|
- spec/rubocop/string_util_spec.rb
|
1017
1038
|
- spec/rubocop/target_finder_spec.rb
|
1018
1039
|
- spec/rubocop/token_spec.rb
|
1019
1040
|
- spec/spec_helper.rb
|
1020
1041
|
- spec/support/cop_helper.rb
|
1042
|
+
- spec/support/cops/class_must_be_a_module_cop.rb
|
1043
|
+
- spec/support/cops/module_must_be_a_class_cop.rb
|
1021
1044
|
- spec/support/coverage.rb
|
1022
1045
|
- spec/support/custom_matchers.rb
|
1023
1046
|
- spec/support/file_helper.rb
|