rubocop 0.15.0 → 0.16.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/.rubocop.yml +1 -10
- data/.travis.yml +2 -1
- data/CHANGELOG.md +55 -0
- data/Gemfile +3 -0
- data/README.md +37 -0
- data/config/default.yml +99 -16
- data/config/enabled.yml +28 -16
- data/lib/rubocop.rb +16 -2
- data/lib/rubocop/cli.rb +10 -91
- data/lib/rubocop/config.rb +4 -1
- data/lib/rubocop/config_loader.rb +18 -10
- data/lib/rubocop/config_store.rb +3 -2
- data/lib/rubocop/cop/check_assignment.rb +43 -0
- data/lib/rubocop/cop/check_methods.rb +18 -0
- data/lib/rubocop/cop/commissioner.rb +15 -3
- data/lib/rubocop/cop/cop.rb +51 -43
- data/lib/rubocop/cop/lint/assignment_in_condition.rb +1 -1
- data/lib/rubocop/cop/lint/block_alignment.rb +7 -7
- data/lib/rubocop/cop/lint/debugger.rb +1 -1
- data/lib/rubocop/cop/lint/empty_ensure.rb +1 -1
- data/lib/rubocop/cop/lint/end_alignment.rb +56 -19
- data/lib/rubocop/cop/lint/end_in_method.rb +4 -10
- data/lib/rubocop/cop/lint/ensure_return.rb +1 -1
- data/lib/rubocop/cop/lint/eval.rb +1 -1
- data/lib/rubocop/cop/lint/handle_exceptions.rb +1 -1
- data/lib/rubocop/cop/lint/literal_in_condition.rb +2 -2
- data/lib/rubocop/cop/lint/loop.rb +1 -1
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
- 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/syntax.rb +1 -1
- data/lib/rubocop/cop/lint/unreachable_code.rb +1 -1
- data/lib/rubocop/cop/lint/useless_assignment.rb +2 -2
- data/lib/rubocop/cop/lint/useless_comparison.rb +1 -1
- data/lib/rubocop/cop/lint/useless_setter_call.rb +6 -16
- data/lib/rubocop/cop/lint/void.rb +5 -5
- data/lib/rubocop/cop/rails/default_scope.rb +33 -0
- data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +2 -4
- data/lib/rubocop/cop/rails/output.rb +1 -1
- data/lib/rubocop/cop/rails/read_attribute.rb +1 -1
- data/lib/rubocop/cop/rails/validation.rb +1 -1
- data/lib/rubocop/cop/style/access_modifier_indentation.rb +31 -16
- data/lib/rubocop/cop/style/accessor_method_name.rb +53 -0
- data/lib/rubocop/cop/style/alias.rb +14 -2
- data/lib/rubocop/cop/style/align_hash.rb +15 -16
- data/lib/rubocop/cop/style/and_or.rb +3 -3
- data/lib/rubocop/cop/style/array_syntax.rb +22 -0
- data/lib/rubocop/cop/style/ascii_comments.rb +1 -1
- data/lib/rubocop/cop/style/ascii_identifiers.rb +1 -3
- data/lib/rubocop/cop/style/attr.rb +1 -1
- data/lib/rubocop/cop/style/autocorrect_alignment.rb +13 -12
- data/lib/rubocop/cop/style/begin_block.rb +1 -1
- data/lib/rubocop/cop/style/block_comments.rb +1 -1
- data/lib/rubocop/cop/style/block_nesting.rb +5 -1
- data/lib/rubocop/cop/style/blocks.rb +4 -4
- data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +48 -22
- data/lib/rubocop/cop/style/case_equality.rb +1 -1
- data/lib/rubocop/cop/style/case_indentation.rb +25 -6
- data/lib/rubocop/cop/style/class_and_module_camel_case.rb +1 -1
- data/lib/rubocop/cop/style/class_length.rb +7 -19
- data/lib/rubocop/cop/style/class_methods.rb +1 -1
- data/lib/rubocop/cop/style/class_vars.rb +1 -1
- data/lib/rubocop/cop/style/code_length.rb +35 -0
- data/lib/rubocop/cop/style/collection_methods.rb +1 -1
- data/lib/rubocop/cop/style/colon_method_call.rb +1 -1
- data/lib/rubocop/cop/style/comment_annotation.rb +1 -1
- data/lib/rubocop/cop/style/configurable_enforced_style.rb +51 -0
- data/lib/rubocop/cop/style/configurable_max.rb +17 -0
- data/lib/rubocop/cop/style/configurable_naming.rb +4 -10
- data/lib/rubocop/cop/style/constant_name.rb +5 -3
- data/lib/rubocop/cop/style/cyclomatic_complexity.rb +8 -13
- data/lib/rubocop/cop/style/def_parentheses.rb +4 -43
- data/lib/rubocop/cop/style/documentation.rb +1 -1
- data/lib/rubocop/cop/style/dot_position.rb +6 -2
- data/lib/rubocop/cop/style/empty_line_between_defs.rb +1 -1
- data/lib/rubocop/cop/style/empty_lines.rb +5 -1
- data/lib/rubocop/cop/style/empty_lines_around_access_modifier.rb +1 -1
- data/lib/rubocop/cop/style/empty_lines_around_body.rb +28 -13
- data/lib/rubocop/cop/style/empty_literal.rb +3 -3
- data/lib/rubocop/cop/style/encoding.rb +5 -5
- data/lib/rubocop/cop/style/end_block.rb +1 -1
- data/lib/rubocop/cop/style/end_of_line.rb +8 -6
- data/lib/rubocop/cop/style/even_odd.rb +6 -6
- data/lib/rubocop/cop/style/favor_join.rb +1 -1
- data/lib/rubocop/cop/style/favor_modifier.rb +20 -34
- data/lib/rubocop/cop/style/favor_sprintf.rb +1 -1
- data/lib/rubocop/cop/style/favor_unless_over_negated_if.rb +1 -1
- data/lib/rubocop/cop/style/final_newline.rb +1 -1
- data/lib/rubocop/cop/style/flip_flop.rb +20 -0
- data/lib/rubocop/cop/style/for.rb +34 -3
- data/lib/rubocop/cop/style/global_vars.rb +1 -1
- data/lib/rubocop/cop/style/hash_methods.rb +3 -3
- data/lib/rubocop/cop/style/hash_syntax.rb +8 -11
- data/lib/rubocop/cop/style/if_node.rb +25 -0
- data/lib/rubocop/cop/style/if_then_else.rb +1 -1
- data/lib/rubocop/cop/style/indentation_width.rb +77 -43
- data/lib/rubocop/cop/style/lambda.rb +2 -2
- data/lib/rubocop/cop/style/lambda_call.rb +4 -12
- data/lib/rubocop/cop/style/leading_comment_space.rb +1 -1
- data/lib/rubocop/cop/style/line_length.rb +9 -5
- data/lib/rubocop/cop/style/method_call_parentheses.rb +1 -1
- data/lib/rubocop/cop/style/method_called_on_do_end_block.rb +1 -1
- data/lib/rubocop/cop/style/method_def_parentheses.rb +52 -0
- data/lib/rubocop/cop/style/method_length.rb +9 -22
- data/lib/rubocop/cop/style/module_function.rb +1 -1
- data/lib/rubocop/cop/style/multiline_block_chain.rb +1 -1
- data/lib/rubocop/cop/style/multiline_if_then.rb +11 -1
- data/lib/rubocop/cop/style/nil_comparison.rb +1 -1
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/numeric_literals.rb +2 -2
- data/lib/rubocop/cop/style/op_method.rb +2 -2
- data/lib/rubocop/cop/style/parameter_lists.rb +2 -2
- data/lib/rubocop/cop/style/parentheses_around_condition.rb +8 -1
- data/lib/rubocop/cop/style/perl_backrefs.rb +1 -1
- data/lib/rubocop/cop/style/predicate_name.rb +54 -0
- data/lib/rubocop/cop/style/proc.rb +1 -1
- data/lib/rubocop/cop/style/raise_args.rb +4 -10
- data/lib/rubocop/cop/style/redundant_begin.rb +5 -15
- data/lib/rubocop/cop/style/redundant_exception.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +9 -19
- data/lib/rubocop/cop/style/redundant_self.rb +8 -3
- data/lib/rubocop/cop/style/regexp_literal.rb +4 -3
- data/lib/rubocop/cop/style/rescue_modifier.rb +9 -17
- data/lib/rubocop/cop/style/semicolon.rb +20 -22
- data/lib/rubocop/cop/style/signal_exception.rb +10 -17
- data/lib/rubocop/cop/style/single_line_block_params.rb +62 -0
- data/lib/rubocop/cop/style/single_line_methods.rb +5 -15
- data/lib/rubocop/cop/style/space_after_comma_etc.rb +1 -3
- data/lib/rubocop/cop/style/space_after_control_keyword.rb +1 -1
- data/lib/rubocop/cop/style/space_after_method_name.rb +4 -12
- data/lib/rubocop/cop/style/space_after_not.rb +1 -1
- data/lib/rubocop/cop/style/space_around_block_braces.rb +105 -94
- data/lib/rubocop/cop/style/space_around_equals_in_parameter_default.rb +1 -1
- data/lib/rubocop/cop/style/space_around_operators.rb +38 -123
- data/lib/rubocop/cop/style/space_before_modifier_keyword.rb +1 -1
- data/lib/rubocop/cop/style/space_inside.rb +1 -3
- data/lib/rubocop/cop/style/space_inside_brackets.rb +0 -2
- data/lib/rubocop/cop/style/space_inside_hash_literal_braces.rb +5 -5
- data/lib/rubocop/cop/style/space_inside_parens.rb +0 -2
- data/lib/rubocop/cop/style/special_global_vars.rb +1 -1
- data/lib/rubocop/cop/style/string_help.rb +1 -1
- data/lib/rubocop/cop/style/string_literals.rb +4 -11
- data/lib/rubocop/cop/style/surrounding_space.rb +0 -2
- data/lib/rubocop/cop/style/symbol_array.rb +3 -10
- data/lib/rubocop/cop/style/tab.rb +5 -5
- data/lib/rubocop/cop/style/ternary_operator.rb +2 -2
- data/lib/rubocop/cop/style/trailing_blank_lines.rb +1 -1
- data/lib/rubocop/cop/style/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/style/trivial_accessors.rb +4 -14
- data/lib/rubocop/cop/style/unless_else.rb +1 -1
- data/lib/rubocop/cop/style/variable_interpolation.rb +1 -1
- data/lib/rubocop/cop/style/when_then.rb +3 -1
- data/lib/rubocop/cop/style/while_until_do.rb +2 -2
- data/lib/rubocop/cop/style/word_array.rb +4 -10
- data/lib/rubocop/cop/util.rb +85 -12
- data/lib/rubocop/cop/variable_inspector.rb +4 -2
- data/lib/rubocop/file_inspector.rb +98 -0
- data/lib/rubocop/formatter/base_formatter.rb +2 -2
- data/lib/rubocop/formatter/disabled_config_formatter.rb +10 -2
- data/lib/rubocop/rake_task.rb +5 -1
- data/lib/rubocop/target_finder.rb +3 -3
- data/lib/rubocop/version.rb +1 -1
- data/rubocop-todo.yml +12 -0
- data/rubocop.gemspec +1 -1
- data/spec/isolated_environment_spec.rb +24 -0
- data/spec/rubocop/cli_spec.rb +120 -27
- data/spec/rubocop/config_loader_spec.rb +25 -11
- data/spec/rubocop/config_spec.rb +25 -9
- data/spec/rubocop/config_store_spec.rb +1 -1
- data/spec/rubocop/cop/cop_spec.rb +22 -3
- data/spec/rubocop/cop/lint/block_alignment_spec.rb +4 -4
- data/spec/rubocop/cop/lint/end_alignment_spec.rb +79 -47
- data/spec/rubocop/cop/lint/syntax_spec.rb +4 -3
- data/spec/rubocop/cop/rails/default_scope_spec.rb +31 -0
- data/spec/rubocop/cop/style/access_modifier_indentation_spec.rb +37 -2
- data/spec/rubocop/cop/style/accessor_method_name_spec.rb +81 -0
- data/spec/rubocop/cop/style/alias_spec.rb +10 -0
- data/spec/rubocop/cop/style/align_parameters_spec.rb +3 -3
- data/spec/rubocop/cop/style/block_nesting_spec.rb +4 -1
- data/spec/rubocop/cop/style/braces_around_hash_parameters_spec.rb +83 -0
- data/spec/rubocop/cop/style/case_indentation_spec.rb +227 -71
- data/spec/rubocop/cop/style/class_length_spec.rb +2 -0
- data/spec/rubocop/cop/style/constant_name_spec.rb +6 -0
- data/spec/rubocop/cop/style/cyclomatic_complexity_spec.rb +1 -0
- data/spec/rubocop/cop/style/documentation_spec.rb +12 -0
- data/spec/rubocop/cop/style/dot_position_spec.rb +10 -0
- data/spec/rubocop/cop/style/empty_lines_around_body_spec.rb +22 -0
- data/spec/rubocop/cop/style/empty_lines_spec.rb +6 -0
- data/spec/rubocop/cop/style/end_of_line_spec.rb +17 -0
- data/spec/rubocop/cop/style/favor_modifier_spec.rb +15 -0
- data/spec/rubocop/cop/style/flip_flop_spec.rb +23 -0
- data/spec/rubocop/cop/style/for_spec.rb +96 -18
- data/spec/rubocop/cop/style/hash_syntax_spec.rb +8 -2
- data/spec/rubocop/cop/style/indentation_width_spec.rb +185 -20
- data/spec/rubocop/cop/style/line_length_spec.rb +1 -0
- data/spec/rubocop/cop/style/method_def_parentheses_spec.rb +72 -0
- data/spec/rubocop/cop/style/multiline_if_then_spec.rb +16 -0
- data/spec/rubocop/cop/style/parentheses_around_condition_spec.rb +34 -3
- data/spec/rubocop/cop/style/predicate_name_spec.rb +25 -0
- data/spec/rubocop/cop/style/redundant_self_spec.rb +15 -0
- data/spec/rubocop/cop/style/regexp_literal_spec.rb +5 -0
- data/spec/rubocop/cop/style/semicolon_spec.rb +16 -16
- data/spec/rubocop/cop/style/{reduce_arguments_spec.rb → single_line_block_params_spec.rb} +12 -4
- data/spec/rubocop/cop/style/space_around_block_braces_spec.rb +58 -8
- data/spec/rubocop/cop/style/space_around_operators_spec.rb +71 -0
- data/spec/rubocop/cop/style/string_literals_spec.rb +18 -0
- data/spec/rubocop/file_inspector_spec.rb +78 -0
- data/spec/rubocop/formatter/clang_style_formatter_spec.rb +7 -7
- data/spec/rubocop/formatter/emacs_style_formatter_spec.rb +3 -3
- data/spec/rubocop/formatter/file_list_formatter_spec.rb +2 -2
- data/spec/rubocop/processed_source_spec.rb +7 -3
- data/spec/rubocop/token_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -2
- data/spec/support/isolated_environment.rb +7 -0
- data/spec/support/shared_context.rb +5 -1
- metadata +35 -12
- data/lib/rubocop/cop/style/reduce_arguments.rb +0 -34
- data/lib/rubocop/cop/style/symbol_name.rb +0 -45
- data/spec/rubocop/cop/style/def_without_parentheses_spec.rb +0 -33
- data/spec/rubocop/cop/style/symbol_name_spec.rb +0 -138
@@ -132,6 +132,9 @@ describe Rubocop::Cop::Style::SpaceAroundOperators do
|
|
132
132
|
' def each &block',
|
133
133
|
' end',
|
134
134
|
'',
|
135
|
+
' def self.search *args',
|
136
|
+
' end',
|
137
|
+
'',
|
135
138
|
' def each *args',
|
136
139
|
' end',
|
137
140
|
''])
|
@@ -229,13 +232,31 @@ describe Rubocop::Cop::Style::SpaceAroundOperators do
|
|
229
232
|
expect(cop.offences).to be_empty
|
230
233
|
end
|
231
234
|
|
235
|
+
it 'registers an offence for a setter call without spaces' do
|
236
|
+
inspect_source(cop, ['x.y=2'])
|
237
|
+
expect(cop.messages).to eq(
|
238
|
+
["Surrounding space missing for operator '='."])
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'registers an offence for a hash rocket without spaces' do
|
242
|
+
inspect_source(cop, ['{ 1=>2, a: b }'])
|
243
|
+
expect(cop.messages).to eq(
|
244
|
+
["Surrounding space missing for operator '=>'."])
|
245
|
+
end
|
246
|
+
|
232
247
|
it 'accepts unary operators without space' do
|
233
248
|
inspect_source(cop, ['[].map(&:size)',
|
234
249
|
'-3',
|
250
|
+
'arr.collect { |e| -e }',
|
235
251
|
'x = +2'])
|
236
252
|
expect(cop.messages).to eq([])
|
237
253
|
end
|
238
254
|
|
255
|
+
it 'accepts [] without space' do
|
256
|
+
inspect_source(cop, ['files[2]'])
|
257
|
+
expect(cop.messages).to eq([])
|
258
|
+
end
|
259
|
+
|
239
260
|
it 'accepts argument default values without space' do
|
240
261
|
# These are handled by SpaceAroundEqualsInParameterDefault,
|
241
262
|
# so SpaceAroundOperators leaves them alone.
|
@@ -250,4 +271,54 @@ describe Rubocop::Cop::Style::SpaceAroundOperators do
|
|
250
271
|
'end'])
|
251
272
|
expect(cop.messages).to be_empty
|
252
273
|
end
|
274
|
+
|
275
|
+
it 'registers an offence for match operators without space' do
|
276
|
+
inspect_source(cop, ['x=~/abc/', 'y !~/abc/'])
|
277
|
+
expect(cop.messages)
|
278
|
+
.to eq(["Surrounding space missing for operator '=~'.",
|
279
|
+
"Surrounding space missing for operator '!~'."])
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'registers an offence for various assignments without space' do
|
283
|
+
inspect_source(cop, ['x||=0', 'y&&=0', 'z*=2',
|
284
|
+
'@a=0', 'a,b=0', 'A=0', 'x[3]=0', '$A=0'])
|
285
|
+
expect(cop.messages)
|
286
|
+
.to eq(["Surrounding space missing for operator '||='.",
|
287
|
+
"Surrounding space missing for operator '&&='.",
|
288
|
+
"Surrounding space missing for operator '*='.",
|
289
|
+
"Surrounding space missing for operator '='.",
|
290
|
+
"Surrounding space missing for operator '='.",
|
291
|
+
"Surrounding space missing for operator '='.",
|
292
|
+
"Surrounding space missing for operator '='.",
|
293
|
+
"Surrounding space missing for operator '='."])
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'registers an offence for equality operators without space' do
|
297
|
+
inspect_source(cop, ['x==0', 'y!=0', 'Hash===z'])
|
298
|
+
expect(cop.messages)
|
299
|
+
.to eq(["Surrounding space missing for operator '=='.",
|
300
|
+
"Surrounding space missing for operator '!='.",
|
301
|
+
"Surrounding space missing for operator '==='."])
|
302
|
+
end
|
303
|
+
|
304
|
+
it 'registers an offence for - without space with negative lhs operand' do
|
305
|
+
inspect_source(cop, ['-1-arg'])
|
306
|
+
expect(cop.messages)
|
307
|
+
.to eq(["Surrounding space missing for operator '-'."])
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'registers an offence for inheritance < without space' do
|
311
|
+
inspect_source(cop, ['class ShowSourceTestClass<ShowSourceTestSuperClass',
|
312
|
+
'end'])
|
313
|
+
expect(cop.messages)
|
314
|
+
.to eq(["Surrounding space missing for operator '<'."])
|
315
|
+
end
|
316
|
+
|
317
|
+
it 'registers an offence for hash rocket without space at rescue' do
|
318
|
+
inspect_source(cop, ['begin',
|
319
|
+
'rescue Exception=>e',
|
320
|
+
'end'])
|
321
|
+
expect(cop.messages)
|
322
|
+
.to eq(["Surrounding space missing for operator '=>'."])
|
323
|
+
end
|
253
324
|
end
|
@@ -33,6 +33,15 @@ describe Rubocop::Cop::Style::StringLiterals, :config do
|
|
33
33
|
expect(cop.offences).to be_empty
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'accepts heredocs' do
|
37
|
+
inspect_source(cop,
|
38
|
+
['execute <<-SQL',
|
39
|
+
' SELECT name from users',
|
40
|
+
'SQL'])
|
41
|
+
|
42
|
+
expect(cop.offences).to be_empty
|
43
|
+
end
|
44
|
+
|
36
45
|
it 'accepts double quotes when they are needed' do
|
37
46
|
src = ['a = "\n"',
|
38
47
|
'b = "#{encode_severity}:' +
|
@@ -119,6 +128,15 @@ describe Rubocop::Cop::Style::StringLiterals, :config do
|
|
119
128
|
expect(cop.offences).to be_empty
|
120
129
|
end
|
121
130
|
|
131
|
+
it 'accepts heredocs' do
|
132
|
+
inspect_source(cop,
|
133
|
+
['execute <<-SQL',
|
134
|
+
' SELECT name from users',
|
135
|
+
'SQL'])
|
136
|
+
|
137
|
+
expect(cop.offences).to be_empty
|
138
|
+
end
|
139
|
+
|
122
140
|
it 'accepts single quotes when they are needed' do
|
123
141
|
src = ["a = '\\n'",
|
124
142
|
"b = '\"'"]
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
class Rubocop::FileInspector
|
6
|
+
attr_writer :errors # Needed only for testing.
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Rubocop::FileInspector do
|
10
|
+
subject(:inspector) { described_class.new(options) }
|
11
|
+
let(:options) { {} }
|
12
|
+
let(:offences) { [] }
|
13
|
+
let(:errors) { [] }
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
$stdout = StringIO.new
|
17
|
+
$stderr = StringIO.new
|
18
|
+
|
19
|
+
inspector.stub(:inspect_file) do
|
20
|
+
inspector.errors = errors
|
21
|
+
offences
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
$stdout = STDOUT
|
27
|
+
$stderr = STDERR
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#display_error_summary' do
|
31
|
+
let(:errors) do
|
32
|
+
['An error occurred while Encoding cop was inspecting file.rb.']
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'displays an error message to stderr when errors are present' do
|
36
|
+
inspector.process_files(['file.rb'], nil) {}
|
37
|
+
inspector.display_error_summary
|
38
|
+
expect($stderr.string.lines.to_a[-6..-5])
|
39
|
+
.to eq(["1 error occurred:\n", "#{errors.first}\n"])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#process_files' do
|
44
|
+
context 'if there are no offences in inspected files' do
|
45
|
+
it 'returns false' do
|
46
|
+
result = inspector.process_files(['file.rb'], nil) {}
|
47
|
+
expect(result).to eq(false)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'if there is an offence in an inspected file' do
|
52
|
+
let(:offences) do
|
53
|
+
[Rubocop::Cop::Offence.new(:convention,
|
54
|
+
Struct.new(:line, :column,
|
55
|
+
:source_line).new(1, 0, ''),
|
56
|
+
'Use alias_method instead of alias.',
|
57
|
+
'Alias')]
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'returns true' do
|
61
|
+
expect(inspector.process_files(['file.rb'], nil) {}).to eq(true)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'sends the offence to a formatter' do
|
65
|
+
inspector.process_files(['file.rb'], nil) {}
|
66
|
+
expect($stdout.string.split("\n"))
|
67
|
+
.to eq(['Inspecting 1 file',
|
68
|
+
'C',
|
69
|
+
'',
|
70
|
+
'Offences:',
|
71
|
+
'',
|
72
|
+
"file.rb:1:1: C: #{offences.first.message}",
|
73
|
+
'',
|
74
|
+
'1 file inspected, 1 offence detected'])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -14,10 +14,10 @@ module Rubocop
|
|
14
14
|
cop = Cop::Cop.new
|
15
15
|
source_buffer = Parser::Source::Buffer.new('test', 1)
|
16
16
|
source_buffer.source = ('aa'..'az').to_a.join($RS)
|
17
|
-
cop.add_offence(
|
17
|
+
cop.add_offence(nil,
|
18
18
|
Parser::Source::Range.new(source_buffer, 0, 2),
|
19
19
|
'message 1')
|
20
|
-
cop.add_offence(
|
20
|
+
cop.add_offence(nil,
|
21
21
|
Parser::Source::Range.new(source_buffer, 30, 32),
|
22
22
|
'message 2')
|
23
23
|
|
@@ -25,7 +25,7 @@ module Rubocop
|
|
25
25
|
expect(output.string).to eq ['test:1:1: C: message 1',
|
26
26
|
'aa',
|
27
27
|
'^^',
|
28
|
-
'test:11:1:
|
28
|
+
'test:11:1: C: message 2',
|
29
29
|
'ak',
|
30
30
|
'^^',
|
31
31
|
''].join("\n")
|
@@ -36,16 +36,16 @@ module Rubocop
|
|
36
36
|
cop = Cop::Cop.new
|
37
37
|
source_buffer = Parser::Source::Buffer.new('test', 1)
|
38
38
|
source_buffer.source = ([' ', 'yaba']).to_a.join($RS)
|
39
|
-
cop.add_offence(
|
39
|
+
cop.add_offence(nil,
|
40
40
|
Parser::Source::Range.new(source_buffer, 0, 2),
|
41
41
|
'message 1')
|
42
|
-
cop.add_offence(
|
42
|
+
cop.add_offence(nil,
|
43
43
|
Parser::Source::Range.new(source_buffer, 6, 10),
|
44
44
|
'message 2')
|
45
45
|
|
46
46
|
formatter.report_file('test', cop.offences)
|
47
47
|
expect(output.string).to eq ['test:1:1: C: message 1',
|
48
|
-
'test:2:1:
|
48
|
+
'test:2:1: C: message 2',
|
49
49
|
'yaba',
|
50
50
|
'^^^^',
|
51
51
|
''].join("\n")
|
@@ -66,7 +66,7 @@ module Rubocop
|
|
66
66
|
source.index(']') + 1)
|
67
67
|
|
68
68
|
cop = Cop::Cop.new
|
69
|
-
cop.add_offence(
|
69
|
+
cop.add_offence(nil, location, 'message 1')
|
70
70
|
|
71
71
|
formatter.report_file('test', cop.offences)
|
72
72
|
expect(output.string).to eq ['test:1:14: C: message 1',
|
@@ -15,16 +15,16 @@ module Rubocop
|
|
15
15
|
source_buffer = Parser::Source::Buffer.new('test', 1)
|
16
16
|
source_buffer.source = %w(a b cdefghi).join("\n")
|
17
17
|
|
18
|
-
cop.add_offence(
|
18
|
+
cop.add_offence(nil,
|
19
19
|
Parser::Source::Range.new(source_buffer, 0, 1),
|
20
20
|
'message 1')
|
21
|
-
cop.add_offence(
|
21
|
+
cop.add_offence(nil,
|
22
22
|
Parser::Source::Range.new(source_buffer, 9, 10),
|
23
23
|
'message 2')
|
24
24
|
|
25
25
|
formatter.file_finished('test', cop.offences)
|
26
26
|
expect(output.string).to eq ['test:1:1: C: message 1',
|
27
|
-
"test:3:6:
|
27
|
+
"test:3:6: C: message 2\n"].join("\n")
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'when the offence is automatically corrected' do
|
@@ -15,10 +15,10 @@ module Rubocop
|
|
15
15
|
source_buffer = Parser::Source::Buffer.new('test', 1)
|
16
16
|
source_buffer.source = %w(a b cdefghi).join("\n")
|
17
17
|
|
18
|
-
cop.add_offence(
|
18
|
+
cop.add_offence(nil,
|
19
19
|
Parser::Source::Range.new(source_buffer, 0, 1),
|
20
20
|
'message 1')
|
21
|
-
cop.add_offence(
|
21
|
+
cop.add_offence(nil,
|
22
22
|
Parser::Source::Range.new(source_buffer, 9, 10),
|
23
23
|
'message 2')
|
24
24
|
|
@@ -66,8 +66,12 @@ describe Rubocop::ProcessedSource do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
describe 'valid_syntax?' do
|
69
|
+
def create_diagnostics(level)
|
70
|
+
Parser::Diagnostic.new(level, :odd_hash, [], double('location'))
|
71
|
+
end
|
72
|
+
|
69
73
|
let(:diagnostics) do
|
70
|
-
[
|
74
|
+
[create_diagnostics(level)]
|
71
75
|
end
|
72
76
|
|
73
77
|
context 'when the source has diagnostic with error level' do
|
@@ -97,8 +101,8 @@ describe Rubocop::ProcessedSource do
|
|
97
101
|
context 'when the source has diagnostics with error and warning level' do
|
98
102
|
let(:diagnostics) do
|
99
103
|
[
|
100
|
-
|
101
|
-
|
104
|
+
create_diagnostics(:error),
|
105
|
+
create_diagnostics(:warning)
|
102
106
|
]
|
103
107
|
end
|
104
108
|
|
data/spec/rubocop/token_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Rubocop::Token do
|
|
6
6
|
describe '.from_parser_token' do
|
7
7
|
subject(:token) { described_class.from_parser_token(parser_token) }
|
8
8
|
let(:parser_token) { [type, [text, range]] }
|
9
|
-
let(:type) { :kDEF }
|
9
|
+
let(:type) { :kDEF }
|
10
10
|
let(:text) { 'def' }
|
11
11
|
let(:range) { double('range') }
|
12
12
|
|
data/spec/spec_helper.rb
CHANGED
@@ -79,6 +79,7 @@ def inspect_source_file(cop, source)
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def inspect_source(cop, source, file = nil)
|
82
|
+
Rubocop::Formatter::DisabledConfigFormatter.config_to_allow_offences = {}
|
82
83
|
processed_source = parse_source(source, file)
|
83
84
|
fail 'Error parsing example code' unless processed_source.valid_syntax?
|
84
85
|
_investigate(cop, processed_source)
|
@@ -113,11 +114,11 @@ end
|
|
113
114
|
|
114
115
|
class Rubocop::Cop::Cop
|
115
116
|
def messages
|
116
|
-
offences.map(&:message)
|
117
|
+
offences.sort.map(&:message)
|
117
118
|
end
|
118
119
|
|
119
120
|
def highlights
|
120
|
-
offences.
|
121
|
+
offences.sort.map { |o| o.location.source }
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
@@ -8,6 +8,13 @@ shared_context 'isolated environment', :isolated_environment do
|
|
8
8
|
Dir.mktmpdir do |tmpdir|
|
9
9
|
original_home = ENV['HOME']
|
10
10
|
|
11
|
+
# Make sure to expand all symlinks in the path first. Otherwise we may
|
12
|
+
# get mismatched pathnames when loading config files later on.
|
13
|
+
tmpdir = File.realpath(tmpdir)
|
14
|
+
|
15
|
+
# Make upwards search for .rubocop.yml files stop at this directory.
|
16
|
+
Rubocop::ConfigLoader.root_level = tmpdir
|
17
|
+
|
11
18
|
begin
|
12
19
|
virtual_home = File.expand_path(File.join(tmpdir, 'home'))
|
13
20
|
Dir.mkdir(virtual_home)
|
@@ -12,7 +12,11 @@ shared_context 'config', :config do
|
|
12
12
|
fail '`cop_config` must be declared with #let'
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
cop_name = described_class.cop_name
|
16
|
+
hash = {
|
17
|
+
cop_name =>
|
18
|
+
Rubocop::ConfigLoader.default_configuration[cop_name].merge(cop_config)
|
19
|
+
}
|
16
20
|
Rubocop::Config.new(hash)
|
17
21
|
end
|
18
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.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: 2013-
|
11
|
+
date: 2013-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: powerpack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,6 +153,8 @@ files:
|
|
153
153
|
- lib/rubocop/config.rb
|
154
154
|
- lib/rubocop/config_loader.rb
|
155
155
|
- lib/rubocop/config_store.rb
|
156
|
+
- lib/rubocop/cop/check_assignment.rb
|
157
|
+
- lib/rubocop/cop/check_methods.rb
|
156
158
|
- lib/rubocop/cop/commissioner.rb
|
157
159
|
- lib/rubocop/cop/cop.rb
|
158
160
|
- lib/rubocop/cop/corrector.rb
|
@@ -177,16 +179,19 @@ files:
|
|
177
179
|
- lib/rubocop/cop/lint/useless_setter_call.rb
|
178
180
|
- lib/rubocop/cop/lint/void.rb
|
179
181
|
- lib/rubocop/cop/offence.rb
|
182
|
+
- lib/rubocop/cop/rails/default_scope.rb
|
180
183
|
- lib/rubocop/cop/rails/has_and_belongs_to_many.rb
|
181
184
|
- lib/rubocop/cop/rails/output.rb
|
182
185
|
- lib/rubocop/cop/rails/read_attribute.rb
|
183
186
|
- lib/rubocop/cop/rails/validation.rb
|
184
187
|
- lib/rubocop/cop/style/access_modifier_indentation.rb
|
188
|
+
- lib/rubocop/cop/style/accessor_method_name.rb
|
185
189
|
- lib/rubocop/cop/style/alias.rb
|
186
190
|
- lib/rubocop/cop/style/align_array.rb
|
187
191
|
- lib/rubocop/cop/style/align_hash.rb
|
188
192
|
- lib/rubocop/cop/style/align_parameters.rb
|
189
193
|
- lib/rubocop/cop/style/and_or.rb
|
194
|
+
- lib/rubocop/cop/style/array_syntax.rb
|
190
195
|
- lib/rubocop/cop/style/ascii_comments.rb
|
191
196
|
- lib/rubocop/cop/style/ascii_identifiers.rb
|
192
197
|
- lib/rubocop/cop/style/attr.rb
|
@@ -203,9 +208,12 @@ files:
|
|
203
208
|
- lib/rubocop/cop/style/class_length.rb
|
204
209
|
- lib/rubocop/cop/style/class_methods.rb
|
205
210
|
- lib/rubocop/cop/style/class_vars.rb
|
211
|
+
- lib/rubocop/cop/style/code_length.rb
|
206
212
|
- lib/rubocop/cop/style/collection_methods.rb
|
207
213
|
- lib/rubocop/cop/style/colon_method_call.rb
|
208
214
|
- lib/rubocop/cop/style/comment_annotation.rb
|
215
|
+
- lib/rubocop/cop/style/configurable_enforced_style.rb
|
216
|
+
- lib/rubocop/cop/style/configurable_max.rb
|
209
217
|
- lib/rubocop/cop/style/configurable_naming.rb
|
210
218
|
- lib/rubocop/cop/style/constant_name.rb
|
211
219
|
- lib/rubocop/cop/style/cyclomatic_complexity.rb
|
@@ -226,10 +234,12 @@ files:
|
|
226
234
|
- lib/rubocop/cop/style/favor_sprintf.rb
|
227
235
|
- lib/rubocop/cop/style/favor_unless_over_negated_if.rb
|
228
236
|
- lib/rubocop/cop/style/final_newline.rb
|
237
|
+
- lib/rubocop/cop/style/flip_flop.rb
|
229
238
|
- lib/rubocop/cop/style/for.rb
|
230
239
|
- lib/rubocop/cop/style/global_vars.rb
|
231
240
|
- lib/rubocop/cop/style/hash_methods.rb
|
232
241
|
- lib/rubocop/cop/style/hash_syntax.rb
|
242
|
+
- lib/rubocop/cop/style/if_node.rb
|
233
243
|
- lib/rubocop/cop/style/if_then_else.rb
|
234
244
|
- lib/rubocop/cop/style/if_with_semicolon.rb
|
235
245
|
- lib/rubocop/cop/style/indentation_width.rb
|
@@ -239,6 +249,7 @@ files:
|
|
239
249
|
- lib/rubocop/cop/style/line_length.rb
|
240
250
|
- lib/rubocop/cop/style/method_call_parentheses.rb
|
241
251
|
- lib/rubocop/cop/style/method_called_on_do_end_block.rb
|
252
|
+
- lib/rubocop/cop/style/method_def_parentheses.rb
|
242
253
|
- lib/rubocop/cop/style/method_length.rb
|
243
254
|
- lib/rubocop/cop/style/method_name.rb
|
244
255
|
- lib/rubocop/cop/style/module_function.rb
|
@@ -252,9 +263,9 @@ files:
|
|
252
263
|
- lib/rubocop/cop/style/parameter_lists.rb
|
253
264
|
- lib/rubocop/cop/style/parentheses_around_condition.rb
|
254
265
|
- lib/rubocop/cop/style/perl_backrefs.rb
|
266
|
+
- lib/rubocop/cop/style/predicate_name.rb
|
255
267
|
- lib/rubocop/cop/style/proc.rb
|
256
268
|
- lib/rubocop/cop/style/raise_args.rb
|
257
|
-
- lib/rubocop/cop/style/reduce_arguments.rb
|
258
269
|
- lib/rubocop/cop/style/redundant_begin.rb
|
259
270
|
- lib/rubocop/cop/style/redundant_exception.rb
|
260
271
|
- lib/rubocop/cop/style/redundant_return.rb
|
@@ -263,6 +274,7 @@ files:
|
|
263
274
|
- lib/rubocop/cop/style/rescue_modifier.rb
|
264
275
|
- lib/rubocop/cop/style/semicolon.rb
|
265
276
|
- lib/rubocop/cop/style/signal_exception.rb
|
277
|
+
- lib/rubocop/cop/style/single_line_block_params.rb
|
266
278
|
- lib/rubocop/cop/style/single_line_methods.rb
|
267
279
|
- lib/rubocop/cop/style/space_after_comma_etc.rb
|
268
280
|
- lib/rubocop/cop/style/space_after_control_keyword.rb
|
@@ -281,7 +293,6 @@ files:
|
|
281
293
|
- lib/rubocop/cop/style/string_literals.rb
|
282
294
|
- lib/rubocop/cop/style/surrounding_space.rb
|
283
295
|
- lib/rubocop/cop/style/symbol_array.rb
|
284
|
-
- lib/rubocop/cop/style/symbol_name.rb
|
285
296
|
- lib/rubocop/cop/style/tab.rb
|
286
297
|
- lib/rubocop/cop/style/ternary_operator.rb
|
287
298
|
- lib/rubocop/cop/style/trailing_blank_lines.rb
|
@@ -302,6 +313,7 @@ files:
|
|
302
313
|
- lib/rubocop/cop/variable_inspector/scope.rb
|
303
314
|
- lib/rubocop/cop/variable_inspector/variable.rb
|
304
315
|
- lib/rubocop/cop/variable_inspector/variable_table.rb
|
316
|
+
- lib/rubocop/file_inspector.rb
|
305
317
|
- lib/rubocop/formatter/base_formatter.rb
|
306
318
|
- lib/rubocop/formatter/clang_style_formatter.rb
|
307
319
|
- lib/rubocop/formatter/disabled_config_formatter.rb
|
@@ -319,8 +331,10 @@ files:
|
|
319
331
|
- lib/rubocop/target_finder.rb
|
320
332
|
- lib/rubocop/token.rb
|
321
333
|
- lib/rubocop/version.rb
|
334
|
+
- rubocop-todo.yml
|
322
335
|
- rubocop.gemspec
|
323
336
|
- spec/.rubocop.yml
|
337
|
+
- spec/isolated_environment_spec.rb
|
324
338
|
- spec/project_spec.rb
|
325
339
|
- spec/rubocop/cli_spec.rb
|
326
340
|
- spec/rubocop/config_loader_spec.rb
|
@@ -350,11 +364,13 @@ files:
|
|
350
364
|
- spec/rubocop/cop/lint/useless_setter_call_spec.rb
|
351
365
|
- spec/rubocop/cop/lint/void_spec.rb
|
352
366
|
- spec/rubocop/cop/offence_spec.rb
|
367
|
+
- spec/rubocop/cop/rails/default_scope_spec.rb
|
353
368
|
- spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb
|
354
369
|
- spec/rubocop/cop/rails/output_spec.rb
|
355
370
|
- spec/rubocop/cop/rails/read_attribute_spec.rb
|
356
371
|
- spec/rubocop/cop/rails/validation_spec.rb
|
357
372
|
- spec/rubocop/cop/style/access_modifier_indentation_spec.rb
|
373
|
+
- spec/rubocop/cop/style/accessor_method_name_spec.rb
|
358
374
|
- spec/rubocop/cop/style/alias_spec.rb
|
359
375
|
- spec/rubocop/cop/style/align_array_spec.rb
|
360
376
|
- spec/rubocop/cop/style/align_hash_spec.rb
|
@@ -381,7 +397,6 @@ files:
|
|
381
397
|
- spec/rubocop/cop/style/constant_name_spec.rb
|
382
398
|
- spec/rubocop/cop/style/cyclomatic_complexity_spec.rb
|
383
399
|
- spec/rubocop/cop/style/def_with_parentheses_spec.rb
|
384
|
-
- spec/rubocop/cop/style/def_without_parentheses_spec.rb
|
385
400
|
- spec/rubocop/cop/style/documentation_spec.rb
|
386
401
|
- spec/rubocop/cop/style/dot_position_spec.rb
|
387
402
|
- spec/rubocop/cop/style/empty_line_between_defs_spec.rb
|
@@ -399,6 +414,7 @@ files:
|
|
399
414
|
- spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb
|
400
415
|
- spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb
|
401
416
|
- spec/rubocop/cop/style/final_newline_spec.rb
|
417
|
+
- spec/rubocop/cop/style/flip_flop_spec.rb
|
402
418
|
- spec/rubocop/cop/style/for_spec.rb
|
403
419
|
- spec/rubocop/cop/style/global_vars_spec.rb
|
404
420
|
- spec/rubocop/cop/style/hash_methods_spec.rb
|
@@ -411,6 +427,7 @@ files:
|
|
411
427
|
- spec/rubocop/cop/style/line_length_spec.rb
|
412
428
|
- spec/rubocop/cop/style/method_call_parentheses_spec.rb
|
413
429
|
- spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb
|
430
|
+
- spec/rubocop/cop/style/method_def_parentheses_spec.rb
|
414
431
|
- spec/rubocop/cop/style/method_length_spec.rb
|
415
432
|
- spec/rubocop/cop/style/method_name_spec.rb
|
416
433
|
- spec/rubocop/cop/style/module_function_spec.rb
|
@@ -424,9 +441,9 @@ files:
|
|
424
441
|
- spec/rubocop/cop/style/parameter_lists_spec.rb
|
425
442
|
- spec/rubocop/cop/style/parentheses_around_condition_spec.rb
|
426
443
|
- spec/rubocop/cop/style/perl_backrefs_spec.rb
|
444
|
+
- spec/rubocop/cop/style/predicate_name_spec.rb
|
427
445
|
- spec/rubocop/cop/style/proc_spec.rb
|
428
446
|
- spec/rubocop/cop/style/raise_args_spec.rb
|
429
|
-
- spec/rubocop/cop/style/reduce_arguments_spec.rb
|
430
447
|
- spec/rubocop/cop/style/redundant_begin_spec.rb
|
431
448
|
- spec/rubocop/cop/style/redundant_exception_spec.rb
|
432
449
|
- spec/rubocop/cop/style/redundant_return_spec.rb
|
@@ -435,6 +452,7 @@ files:
|
|
435
452
|
- spec/rubocop/cop/style/rescue_modifier_spec.rb
|
436
453
|
- spec/rubocop/cop/style/semicolon_spec.rb
|
437
454
|
- spec/rubocop/cop/style/signal_exception_spec.rb
|
455
|
+
- spec/rubocop/cop/style/single_line_block_params_spec.rb
|
438
456
|
- spec/rubocop/cop/style/single_line_methods_spec.rb
|
439
457
|
- spec/rubocop/cop/style/space_after_colon_spec.rb
|
440
458
|
- spec/rubocop/cop/style/space_after_comma_spec.rb
|
@@ -452,7 +470,6 @@ files:
|
|
452
470
|
- spec/rubocop/cop/style/special_global_vars_spec.rb
|
453
471
|
- spec/rubocop/cop/style/string_literals_spec.rb
|
454
472
|
- spec/rubocop/cop/style/symbol_array_spec.rb
|
455
|
-
- spec/rubocop/cop/style/symbol_name_spec.rb
|
456
473
|
- spec/rubocop/cop/style/tab_spec.rb
|
457
474
|
- spec/rubocop/cop/style/ternary_operator_spec.rb
|
458
475
|
- spec/rubocop/cop/style/trailing_blank_lines_spec.rb
|
@@ -472,6 +489,7 @@ files:
|
|
472
489
|
- spec/rubocop/cop/variable_inspector/variable_spec.rb
|
473
490
|
- spec/rubocop/cop/variable_inspector/variable_table_spec.rb
|
474
491
|
- spec/rubocop/cop/variable_inspector_spec.rb
|
492
|
+
- spec/rubocop/file_inspector_spec.rb
|
475
493
|
- spec/rubocop/formatter/base_formatter_spec.rb
|
476
494
|
- spec/rubocop/formatter/clang_style_formatter_spec.rb
|
477
495
|
- spec/rubocop/formatter/disabled_config_formatter_spec.rb
|
@@ -520,6 +538,7 @@ specification_version: 4
|
|
520
538
|
summary: Automatic Ruby code style checking tool.
|
521
539
|
test_files:
|
522
540
|
- spec/.rubocop.yml
|
541
|
+
- spec/isolated_environment_spec.rb
|
523
542
|
- spec/project_spec.rb
|
524
543
|
- spec/rubocop/cli_spec.rb
|
525
544
|
- spec/rubocop/config_loader_spec.rb
|
@@ -549,11 +568,13 @@ test_files:
|
|
549
568
|
- spec/rubocop/cop/lint/useless_setter_call_spec.rb
|
550
569
|
- spec/rubocop/cop/lint/void_spec.rb
|
551
570
|
- spec/rubocop/cop/offence_spec.rb
|
571
|
+
- spec/rubocop/cop/rails/default_scope_spec.rb
|
552
572
|
- spec/rubocop/cop/rails/has_and_belongs_to_many_spec.rb
|
553
573
|
- spec/rubocop/cop/rails/output_spec.rb
|
554
574
|
- spec/rubocop/cop/rails/read_attribute_spec.rb
|
555
575
|
- spec/rubocop/cop/rails/validation_spec.rb
|
556
576
|
- spec/rubocop/cop/style/access_modifier_indentation_spec.rb
|
577
|
+
- spec/rubocop/cop/style/accessor_method_name_spec.rb
|
557
578
|
- spec/rubocop/cop/style/alias_spec.rb
|
558
579
|
- spec/rubocop/cop/style/align_array_spec.rb
|
559
580
|
- spec/rubocop/cop/style/align_hash_spec.rb
|
@@ -580,7 +601,6 @@ test_files:
|
|
580
601
|
- spec/rubocop/cop/style/constant_name_spec.rb
|
581
602
|
- spec/rubocop/cop/style/cyclomatic_complexity_spec.rb
|
582
603
|
- spec/rubocop/cop/style/def_with_parentheses_spec.rb
|
583
|
-
- spec/rubocop/cop/style/def_without_parentheses_spec.rb
|
584
604
|
- spec/rubocop/cop/style/documentation_spec.rb
|
585
605
|
- spec/rubocop/cop/style/dot_position_spec.rb
|
586
606
|
- spec/rubocop/cop/style/empty_line_between_defs_spec.rb
|
@@ -598,6 +618,7 @@ test_files:
|
|
598
618
|
- spec/rubocop/cop/style/favor_unless_over_negated_if_spec.rb
|
599
619
|
- spec/rubocop/cop/style/favor_until_over_negated_while_spec.rb
|
600
620
|
- spec/rubocop/cop/style/final_newline_spec.rb
|
621
|
+
- spec/rubocop/cop/style/flip_flop_spec.rb
|
601
622
|
- spec/rubocop/cop/style/for_spec.rb
|
602
623
|
- spec/rubocop/cop/style/global_vars_spec.rb
|
603
624
|
- spec/rubocop/cop/style/hash_methods_spec.rb
|
@@ -610,6 +631,7 @@ test_files:
|
|
610
631
|
- spec/rubocop/cop/style/line_length_spec.rb
|
611
632
|
- spec/rubocop/cop/style/method_call_parentheses_spec.rb
|
612
633
|
- spec/rubocop/cop/style/method_called_on_do_end_block_spec.rb
|
634
|
+
- spec/rubocop/cop/style/method_def_parentheses_spec.rb
|
613
635
|
- spec/rubocop/cop/style/method_length_spec.rb
|
614
636
|
- spec/rubocop/cop/style/method_name_spec.rb
|
615
637
|
- spec/rubocop/cop/style/module_function_spec.rb
|
@@ -623,9 +645,9 @@ test_files:
|
|
623
645
|
- spec/rubocop/cop/style/parameter_lists_spec.rb
|
624
646
|
- spec/rubocop/cop/style/parentheses_around_condition_spec.rb
|
625
647
|
- spec/rubocop/cop/style/perl_backrefs_spec.rb
|
648
|
+
- spec/rubocop/cop/style/predicate_name_spec.rb
|
626
649
|
- spec/rubocop/cop/style/proc_spec.rb
|
627
650
|
- spec/rubocop/cop/style/raise_args_spec.rb
|
628
|
-
- spec/rubocop/cop/style/reduce_arguments_spec.rb
|
629
651
|
- spec/rubocop/cop/style/redundant_begin_spec.rb
|
630
652
|
- spec/rubocop/cop/style/redundant_exception_spec.rb
|
631
653
|
- spec/rubocop/cop/style/redundant_return_spec.rb
|
@@ -634,6 +656,7 @@ test_files:
|
|
634
656
|
- spec/rubocop/cop/style/rescue_modifier_spec.rb
|
635
657
|
- spec/rubocop/cop/style/semicolon_spec.rb
|
636
658
|
- spec/rubocop/cop/style/signal_exception_spec.rb
|
659
|
+
- spec/rubocop/cop/style/single_line_block_params_spec.rb
|
637
660
|
- spec/rubocop/cop/style/single_line_methods_spec.rb
|
638
661
|
- spec/rubocop/cop/style/space_after_colon_spec.rb
|
639
662
|
- spec/rubocop/cop/style/space_after_comma_spec.rb
|
@@ -651,7 +674,6 @@ test_files:
|
|
651
674
|
- spec/rubocop/cop/style/special_global_vars_spec.rb
|
652
675
|
- spec/rubocop/cop/style/string_literals_spec.rb
|
653
676
|
- spec/rubocop/cop/style/symbol_array_spec.rb
|
654
|
-
- spec/rubocop/cop/style/symbol_name_spec.rb
|
655
677
|
- spec/rubocop/cop/style/tab_spec.rb
|
656
678
|
- spec/rubocop/cop/style/ternary_operator_spec.rb
|
657
679
|
- spec/rubocop/cop/style/trailing_blank_lines_spec.rb
|
@@ -671,6 +693,7 @@ test_files:
|
|
671
693
|
- spec/rubocop/cop/variable_inspector/variable_spec.rb
|
672
694
|
- spec/rubocop/cop/variable_inspector/variable_table_spec.rb
|
673
695
|
- spec/rubocop/cop/variable_inspector_spec.rb
|
696
|
+
- spec/rubocop/file_inspector_spec.rb
|
674
697
|
- spec/rubocop/formatter/base_formatter_spec.rb
|
675
698
|
- spec/rubocop/formatter/clang_style_formatter_spec.rb
|
676
699
|
- spec/rubocop/formatter/disabled_config_formatter_spec.rb
|