rubocop 0.74.0 → 0.75.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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/config/default.yml +27 -3
  4. data/lib/rubocop.rb +6 -1
  5. data/lib/rubocop/ast/node/mixin/method_dispatch_node.rb +1 -12
  6. data/lib/rubocop/comment_config.rb +3 -2
  7. data/lib/rubocop/config.rb +4 -0
  8. data/lib/rubocop/config_loader.rb +20 -2
  9. data/lib/rubocop/config_loader_resolver.rb +2 -2
  10. data/lib/rubocop/config_obsoletion.rb +12 -0
  11. data/lib/rubocop/cop/autocorrect_logic.rb +2 -2
  12. data/lib/rubocop/cop/cop.rb +4 -3
  13. data/lib/rubocop/cop/correctors/alignment_corrector.rb +43 -17
  14. data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +2 -2
  15. data/lib/rubocop/cop/generator.rb +3 -3
  16. data/lib/rubocop/cop/generator/configuration_injector.rb +9 -4
  17. data/lib/rubocop/cop/generator/require_file_injector.rb +1 -1
  18. data/lib/rubocop/cop/layout/block_alignment.rb +2 -2
  19. data/lib/rubocop/cop/layout/closing_parenthesis_indentation.rb +1 -1
  20. data/lib/rubocop/cop/layout/extra_spacing.rb +0 -6
  21. data/lib/rubocop/cop/layout/indent_assignment.rb +9 -1
  22. data/lib/rubocop/cop/layout/indent_heredoc.rb +1 -1
  23. data/lib/rubocop/cop/layout/multiline_block_layout.rb +24 -2
  24. data/lib/rubocop/cop/layout/space_around_block_parameters.rb +5 -1
  25. data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +1 -1
  26. data/lib/rubocop/cop/layout/space_inside_block_braces.rb +7 -0
  27. data/lib/rubocop/cop/layout/space_inside_string_interpolation.rb +2 -0
  28. data/lib/rubocop/cop/lint/assignment_in_condition.rb +17 -4
  29. data/lib/rubocop/cop/lint/debugger.rb +1 -1
  30. data/lib/rubocop/cop/lint/format_parameter_mismatch.rb +10 -36
  31. data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
  32. data/lib/rubocop/cop/lint/send_with_mixin_argument.rb +91 -0
  33. data/lib/rubocop/cop/lint/unneeded_cop_disable_directive.rb +1 -1
  34. data/lib/rubocop/cop/message_annotator.rb +16 -7
  35. data/lib/rubocop/cop/migration/department_name.rb +44 -0
  36. data/lib/rubocop/cop/mixin/alignment.rb +1 -1
  37. data/lib/rubocop/cop/mixin/frozen_string_literal.rb +1 -1
  38. data/lib/rubocop/cop/mixin/safe_mode.rb +2 -0
  39. data/lib/rubocop/cop/naming/method_name.rb +12 -1
  40. data/lib/rubocop/cop/naming/variable_name.rb +1 -0
  41. data/lib/rubocop/cop/offense.rb +18 -7
  42. data/lib/rubocop/cop/registry.rb +22 -1
  43. data/lib/rubocop/cop/style/access_modifier_declarations.rb +1 -0
  44. data/lib/rubocop/cop/style/block_delimiters.rb +2 -1
  45. data/lib/rubocop/cop/style/braces_around_hash_parameters.rb +29 -10
  46. data/lib/rubocop/cop/style/class_and_module_children.rb +1 -1
  47. data/lib/rubocop/cop/style/commented_keyword.rb +8 -2
  48. data/lib/rubocop/cop/style/conditional_assignment.rb +4 -4
  49. data/lib/rubocop/cop/style/double_cop_disable_directive.rb +8 -2
  50. data/lib/rubocop/cop/style/format_string_token.rb +10 -40
  51. data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +18 -33
  52. data/lib/rubocop/cop/style/if_unless_modifier.rb +51 -15
  53. data/lib/rubocop/cop/style/infinite_loop.rb +1 -1
  54. data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +5 -5
  55. data/lib/rubocop/cop/style/mixin_usage.rb +11 -1
  56. data/lib/rubocop/cop/style/multiline_memoization.rb +1 -1
  57. data/lib/rubocop/cop/style/nested_modifier.rb +18 -2
  58. data/lib/rubocop/cop/style/or_assignment.rb +6 -1
  59. data/lib/rubocop/cop/style/parentheses_around_condition.rb +14 -0
  60. data/lib/rubocop/cop/style/redundant_parentheses.rb +13 -4
  61. data/lib/rubocop/cop/style/redundant_self.rb +18 -1
  62. data/lib/rubocop/cop/style/rescue_modifier.rb +24 -0
  63. data/lib/rubocop/cop/style/safe_navigation.rb +9 -0
  64. data/lib/rubocop/cop/style/single_line_methods.rb +8 -1
  65. data/lib/rubocop/cop/style/ternary_parentheses.rb +19 -0
  66. data/lib/rubocop/cop/utils/format_string.rb +128 -0
  67. data/lib/rubocop/cop/variable_force/variable.rb +15 -2
  68. data/lib/rubocop/core_ext/string.rb +0 -24
  69. data/lib/rubocop/formatter/emacs_style_formatter.rb +8 -5
  70. data/lib/rubocop/formatter/formatter_set.rb +2 -1
  71. data/lib/rubocop/formatter/pacman_formatter.rb +80 -0
  72. data/lib/rubocop/formatter/simple_text_formatter.rb +9 -1
  73. data/lib/rubocop/formatter/tap_formatter.rb +9 -1
  74. data/lib/rubocop/magic_comment.rb +4 -0
  75. data/lib/rubocop/options.rb +2 -1
  76. data/lib/rubocop/runner.rb +14 -8
  77. data/lib/rubocop/version.rb +1 -1
  78. metadata +6 -3
  79. data/lib/rubocop/cop/mixin/ignored_method_patterns.rb +0 -19
@@ -155,10 +155,10 @@ module RuboCop
155
155
  if cop.relevant_file?(file)
156
156
  cop.check(offenses, source.disabled_line_ranges, source.comments)
157
157
  offenses += cop.offenses
158
- autocorrect_unneeded_disables(source, cop)
158
+ offenses += autocorrect_unneeded_disables(file, source, cop,
159
+ offenses)
159
160
  end
160
161
  end
161
- offenses
162
162
  end
163
163
 
164
164
  offenses.sort.reject(&:disabled?).freeze
@@ -172,14 +172,20 @@ module RuboCop
172
172
  @options[:except] || @options[:only]
173
173
  end
174
174
 
175
- def autocorrect_unneeded_disables(source, cop)
175
+ def autocorrect_unneeded_disables(file, source, cop, offenses)
176
176
  cop.processed_source = source
177
177
 
178
- Cop::Team.new(
179
- RuboCop::Cop::Registry.new,
180
- nil,
181
- @options
182
- ).autocorrect(source.buffer, [cop])
178
+ team = Cop::Team.new(RuboCop::Cop::Registry.new, nil, @options)
179
+ team.autocorrect(source.buffer, [cop])
180
+
181
+ return [] unless team.updated_source_file?
182
+
183
+ # Do one extra inspection loop if any unneeded disables were
184
+ # removed. This is done in order to find rubocop:enable directives that
185
+ # have now become useless.
186
+ _source, new_offenses = do_inspection_loop(file,
187
+ get_processed_source(file))
188
+ new_offenses - offenses
183
189
  end
184
190
 
185
191
  def file_started(file)
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.74.0'
6
+ STRING = '0.75.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.74.0
4
+ version: 0.75.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-07-31 00:00:00.000000000 Z
13
+ date: 2019-09-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jaro_winkler
@@ -389,6 +389,7 @@ files:
389
389
  - lib/rubocop/cop/lint/safe_navigation_consistency.rb
390
390
  - lib/rubocop/cop/lint/safe_navigation_with_empty.rb
391
391
  - lib/rubocop/cop/lint/script_permission.rb
392
+ - lib/rubocop/cop/lint/send_with_mixin_argument.rb
392
393
  - lib/rubocop/cop/lint/shadowed_argument.rb
393
394
  - lib/rubocop/cop/lint/shadowed_exception.rb
394
395
  - lib/rubocop/cop/lint/shadowing_outer_local_variable.rb
@@ -424,6 +425,7 @@ files:
424
425
  - lib/rubocop/cop/metrics/parameter_lists.rb
425
426
  - lib/rubocop/cop/metrics/perceived_complexity.rb
426
427
  - lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
428
+ - lib/rubocop/cop/migration/department_name.rb
427
429
  - lib/rubocop/cop/mixin/alignment.rb
428
430
  - lib/rubocop/cop/mixin/annotation_comment.rb
429
431
  - lib/rubocop/cop/mixin/array_min_size.rb
@@ -448,7 +450,6 @@ files:
448
450
  - lib/rubocop/cop/mixin/frozen_string_literal.rb
449
451
  - lib/rubocop/cop/mixin/hash_alignment.rb
450
452
  - lib/rubocop/cop/mixin/heredoc.rb
451
- - lib/rubocop/cop/mixin/ignored_method_patterns.rb
452
453
  - lib/rubocop/cop/mixin/ignored_methods.rb
453
454
  - lib/rubocop/cop/mixin/ignored_pattern.rb
454
455
  - lib/rubocop/cop/mixin/integer_node.rb
@@ -683,6 +684,7 @@ files:
683
684
  - lib/rubocop/cop/style/zero_length_predicate.rb
684
685
  - lib/rubocop/cop/team.rb
685
686
  - lib/rubocop/cop/util.rb
687
+ - lib/rubocop/cop/utils/format_string.rb
686
688
  - lib/rubocop/cop/variable_force.rb
687
689
  - lib/rubocop/cop/variable_force/assignment.rb
688
690
  - lib/rubocop/cop/variable_force/branch.rb
@@ -707,6 +709,7 @@ files:
707
709
  - lib/rubocop/formatter/html_formatter.rb
708
710
  - lib/rubocop/formatter/json_formatter.rb
709
711
  - lib/rubocop/formatter/offense_count_formatter.rb
712
+ - lib/rubocop/formatter/pacman_formatter.rb
710
713
  - lib/rubocop/formatter/progress_formatter.rb
711
714
  - lib/rubocop/formatter/quiet_formatter.rb
712
715
  - lib/rubocop/formatter/simple_text_formatter.rb
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- # This module encapsulates the ability to ignore certain methods when
6
- # parsing using regex patterns.
7
- module IgnoredMethodPatterns
8
- private
9
-
10
- def ignored_method_pattern?(name)
11
- ignored_method_patterns.any? { |pattern| Regexp.new(pattern) =~ name }
12
- end
13
-
14
- def ignored_method_patterns
15
- cop_config.fetch('IgnoredMethodPatterns', [])
16
- end
17
- end
18
- end
19
- end