rubocop 0.75.1 → 0.76.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +52 -53
  4. data/lib/rubocop.rb +10 -9
  5. data/lib/rubocop/ast/builder.rb +1 -0
  6. data/lib/rubocop/ast/node.rb +4 -0
  7. data/lib/rubocop/ast/node/return_node.rb +24 -0
  8. data/lib/rubocop/cli.rb +7 -4
  9. data/lib/rubocop/comment_config.rb +2 -2
  10. data/lib/rubocop/config.rb +7 -0
  11. data/lib/rubocop/config_loader.rb +1 -1
  12. data/lib/rubocop/config_loader_resolver.rb +2 -1
  13. data/lib/rubocop/config_obsoletion.rb +9 -0
  14. data/lib/rubocop/config_validator.rb +24 -15
  15. data/lib/rubocop/cop/commissioner.rb +15 -7
  16. data/lib/rubocop/cop/cop.rb +10 -6
  17. data/lib/rubocop/cop/corrector.rb +8 -7
  18. data/lib/rubocop/cop/generator/configuration_injector.rb +1 -1
  19. data/lib/rubocop/cop/layout/align_hash.rb +6 -2
  20. data/lib/rubocop/cop/layout/comment_indentation.rb +10 -13
  21. data/lib/rubocop/cop/layout/empty_comment.rb +7 -16
  22. data/lib/rubocop/cop/layout/end_of_line.rb +8 -3
  23. data/lib/rubocop/cop/layout/indent_first_argument.rb +9 -7
  24. data/lib/rubocop/cop/layout/indent_first_hash_element.rb +1 -1
  25. data/lib/rubocop/cop/layout/multiline_assignment_layout.rb +1 -1
  26. data/lib/rubocop/cop/layout/rescue_ensure_alignment.rb +2 -0
  27. data/lib/rubocop/cop/layout/space_in_lambda_literal.rb +9 -7
  28. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +7 -4
  29. data/lib/rubocop/cop/layout/space_inside_parens.rb +6 -6
  30. data/lib/rubocop/cop/layout/trailing_whitespace.rb +18 -2
  31. data/lib/rubocop/cop/lint/erb_new_arguments.rb +9 -8
  32. data/lib/rubocop/cop/lint/missing_cop_enable_directive.rb +2 -2
  33. data/lib/rubocop/cop/lint/{unneeded_cop_disable_directive.rb → redundant_cop_disable_directive.rb} +23 -23
  34. data/lib/rubocop/cop/lint/{unneeded_cop_enable_directive.rb → redundant_cop_enable_directive.rb} +6 -8
  35. data/lib/rubocop/cop/lint/{unneeded_require_statement.rb → redundant_require_statement.rb} +1 -1
  36. data/lib/rubocop/cop/lint/{unneeded_splat_expansion.rb → redundant_splat_expansion.rb} +5 -5
  37. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +5 -6
  38. data/lib/rubocop/cop/lint/void.rb +4 -4
  39. data/lib/rubocop/cop/metrics/abc_size.rb +1 -1
  40. data/lib/rubocop/cop/metrics/line_length.rb +1 -4
  41. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +23 -6
  42. data/lib/rubocop/cop/mixin/method_complexity.rb +2 -1
  43. data/lib/rubocop/cop/mixin/statement_modifier.rb +5 -2
  44. data/lib/rubocop/cop/mixin/trailing_comma.rb +8 -6
  45. data/lib/rubocop/cop/naming/file_name.rb +12 -5
  46. data/lib/rubocop/cop/registry.rb +1 -1
  47. data/lib/rubocop/cop/style/attr.rb +2 -2
  48. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +6 -6
  49. data/lib/rubocop/cop/style/comment_annotation.rb +5 -5
  50. data/lib/rubocop/cop/style/copyright.rb +11 -7
  51. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +2 -2
  52. data/lib/rubocop/cop/style/empty_case_condition.rb +2 -2
  53. data/lib/rubocop/cop/style/empty_literal.rb +2 -2
  54. data/lib/rubocop/cop/style/empty_method.rb +5 -5
  55. data/lib/rubocop/cop/style/format_string.rb +10 -7
  56. data/lib/rubocop/cop/style/format_string_token.rb +2 -0
  57. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +10 -0
  58. data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
  59. data/lib/rubocop/cop/style/if_unless_modifier.rb +9 -2
  60. data/lib/rubocop/cop/style/infinite_loop.rb +4 -3
  61. data/lib/rubocop/cop/style/inverse_methods.rb +19 -13
  62. data/lib/rubocop/cop/style/line_end_concatenation.rb +14 -10
  63. data/lib/rubocop/cop/style/method_def_parentheses.rb +17 -9
  64. data/lib/rubocop/cop/style/multiline_when_then.rb +1 -1
  65. data/lib/rubocop/cop/style/nested_modifier.rb +4 -2
  66. data/lib/rubocop/cop/style/non_nil_check.rb +21 -9
  67. data/lib/rubocop/cop/style/{unneeded_capital_w.rb → redundant_capital_w.rb} +1 -1
  68. data/lib/rubocop/cop/style/{unneeded_condition.rb → redundant_condition.rb} +3 -3
  69. data/lib/rubocop/cop/style/{unneeded_interpolation.rb → redundant_interpolation.rb} +1 -1
  70. data/lib/rubocop/cop/style/{unneeded_percent_q.rb → redundant_percent_q.rb} +1 -1
  71. data/lib/rubocop/cop/style/redundant_return.rb +25 -21
  72. data/lib/rubocop/cop/style/{unneeded_sort.rb → redundant_sort.rb} +4 -4
  73. data/lib/rubocop/cop/style/safe_navigation.rb +13 -10
  74. data/lib/rubocop/cop/style/semicolon.rb +2 -2
  75. data/lib/rubocop/cop/style/special_global_vars.rb +5 -7
  76. data/lib/rubocop/cop/util.rb +1 -1
  77. data/lib/rubocop/cop/utils/format_string.rb +10 -18
  78. data/lib/rubocop/cop/variable_force.rb +7 -5
  79. data/lib/rubocop/node_pattern.rb +3 -1
  80. data/lib/rubocop/options.rb +12 -6
  81. data/lib/rubocop/result_cache.rb +1 -1
  82. data/lib/rubocop/runner.rb +32 -27
  83. data/lib/rubocop/target_finder.rb +12 -6
  84. data/lib/rubocop/version.rb +1 -1
  85. metadata +12 -11
@@ -65,12 +65,7 @@ module RuboCop
65
65
  to_inspect?(file, hidden_files, base_dir_config)
66
66
  end
67
67
 
68
- if fail_fast?
69
- # Most recently modified file first.
70
- target_files.sort_by! { |path| -Integer(File.mtime(path)) }
71
- else
72
- target_files.sort!
73
- end
68
+ target_files.sort_by!(&order)
74
69
  end
75
70
 
76
71
  def to_inspect?(file, hidden_files, base_dir_config)
@@ -186,5 +181,16 @@ module RuboCop
186
181
  config.file_to_exclude?(file)
187
182
  end
188
183
  end
184
+
185
+ private
186
+
187
+ def order
188
+ if fail_fast?
189
+ # Most recently modified file first.
190
+ ->(path) { -Integer(File.mtime(path)) }
191
+ else
192
+ :itself
193
+ end
194
+ end
189
195
  end
190
196
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.75.1'
6
+ STRING = '0.76.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
9
9
  '%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'
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.75.1
4
+ version: 0.76.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-10-14 00:00:00.000000000 Z
13
+ date: 2019-10-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jaro_winkler
@@ -185,6 +185,7 @@ files:
185
185
  - lib/rubocop/ast/node/regexp_node.rb
186
186
  - lib/rubocop/ast/node/resbody_node.rb
187
187
  - lib/rubocop/ast/node/retry_node.rb
188
+ - lib/rubocop/ast/node/return_node.rb
188
189
  - lib/rubocop/ast/node/self_class_node.rb
189
190
  - lib/rubocop/ast/node/send_node.rb
190
191
  - lib/rubocop/ast/node/str_node.rb
@@ -378,6 +379,10 @@ files:
378
379
  - lib/rubocop/cop/lint/percent_string_array.rb
379
380
  - lib/rubocop/cop/lint/percent_symbol_array.rb
380
381
  - lib/rubocop/cop/lint/rand_one.rb
382
+ - lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
383
+ - lib/rubocop/cop/lint/redundant_cop_enable_directive.rb
384
+ - lib/rubocop/cop/lint/redundant_require_statement.rb
385
+ - lib/rubocop/cop/lint/redundant_splat_expansion.rb
381
386
  - lib/rubocop/cop/lint/redundant_with_index.rb
382
387
  - lib/rubocop/cop/lint/redundant_with_object.rb
383
388
  - lib/rubocop/cop/lint/regexp_as_condition.rb
@@ -398,10 +403,6 @@ files:
398
403
  - lib/rubocop/cop/lint/to_json.rb
399
404
  - lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb
400
405
  - lib/rubocop/cop/lint/unified_integer.rb
401
- - lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb
402
- - lib/rubocop/cop/lint/unneeded_cop_enable_directive.rb
403
- - lib/rubocop/cop/lint/unneeded_require_statement.rb
404
- - lib/rubocop/cop/lint/unneeded_splat_expansion.rb
405
406
  - lib/rubocop/cop/lint/unreachable_code.rb
406
407
  - lib/rubocop/cop/lint/unused_block_argument.rb
407
408
  - lib/rubocop/cop/lint/unused_method_argument.rb
@@ -627,12 +628,17 @@ files:
627
628
  - lib/rubocop/cop/style/raise_args.rb
628
629
  - lib/rubocop/cop/style/random_with_offset.rb
629
630
  - lib/rubocop/cop/style/redundant_begin.rb
631
+ - lib/rubocop/cop/style/redundant_capital_w.rb
632
+ - lib/rubocop/cop/style/redundant_condition.rb
630
633
  - lib/rubocop/cop/style/redundant_conditional.rb
631
634
  - lib/rubocop/cop/style/redundant_exception.rb
632
635
  - lib/rubocop/cop/style/redundant_freeze.rb
636
+ - lib/rubocop/cop/style/redundant_interpolation.rb
633
637
  - lib/rubocop/cop/style/redundant_parentheses.rb
638
+ - lib/rubocop/cop/style/redundant_percent_q.rb
634
639
  - lib/rubocop/cop/style/redundant_return.rb
635
640
  - lib/rubocop/cop/style/redundant_self.rb
641
+ - lib/rubocop/cop/style/redundant_sort.rb
636
642
  - lib/rubocop/cop/style/redundant_sort_by.rb
637
643
  - lib/rubocop/cop/style/regexp_literal.rb
638
644
  - lib/rubocop/cop/style/rescue_modifier.rb
@@ -669,11 +675,6 @@ files:
669
675
  - lib/rubocop/cop/style/trailing_underscore_variable.rb
670
676
  - lib/rubocop/cop/style/trivial_accessors.rb
671
677
  - lib/rubocop/cop/style/unless_else.rb
672
- - lib/rubocop/cop/style/unneeded_capital_w.rb
673
- - lib/rubocop/cop/style/unneeded_condition.rb
674
- - lib/rubocop/cop/style/unneeded_interpolation.rb
675
- - lib/rubocop/cop/style/unneeded_percent_q.rb
676
- - lib/rubocop/cop/style/unneeded_sort.rb
677
678
  - lib/rubocop/cop/style/unpack_first.rb
678
679
  - lib/rubocop/cop/style/variable_interpolation.rb
679
680
  - lib/rubocop/cop/style/when_then.rb