rubocop 1.4.2 → 1.5.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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +47 -7
  4. data/lib/rubocop.rb +4 -0
  5. data/lib/rubocop/cli.rb +5 -1
  6. data/lib/rubocop/cli/command/suggest_extensions.rb +67 -0
  7. data/lib/rubocop/config_loader.rb +1 -1
  8. data/lib/rubocop/config_loader_resolver.rb +5 -1
  9. data/lib/rubocop/config_obsoletion.rb +21 -3
  10. data/lib/rubocop/config_validator.rb +8 -1
  11. data/lib/rubocop/cop/generator.rb +1 -1
  12. data/lib/rubocop/cop/layout/empty_lines_around_arguments.rb +6 -1
  13. data/lib/rubocop/cop/layout/end_of_line.rb +5 -5
  14. data/lib/rubocop/cop/layout/first_argument_indentation.rb +7 -2
  15. data/lib/rubocop/cop/lint/no_return_in_begin_end_blocks.rb +1 -1
  16. data/lib/rubocop/cop/lint/unexpected_block_arity.rb +85 -0
  17. data/lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb +8 -5
  18. data/lib/rubocop/cop/metrics/abc_size.rb +25 -1
  19. data/lib/rubocop/cop/metrics/block_length.rb +13 -7
  20. data/lib/rubocop/cop/metrics/method_length.rb +7 -2
  21. data/lib/rubocop/cop/metrics/parameter_lists.rb +64 -1
  22. data/lib/rubocop/cop/metrics/utils/abc_size_calculator.rb +20 -10
  23. data/lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb +146 -0
  24. data/lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb +6 -1
  25. data/lib/rubocop/cop/mixin/ignored_methods.rb +36 -3
  26. data/lib/rubocop/cop/mixin/method_complexity.rb +6 -0
  27. data/lib/rubocop/cop/style/and_or.rb +10 -0
  28. data/lib/rubocop/cop/style/class_and_module_children.rb +8 -3
  29. data/lib/rubocop/cop/style/if_with_semicolon.rb +39 -4
  30. data/lib/rubocop/cop/style/method_call_without_args_parentheses.rb +11 -2
  31. data/lib/rubocop/cop/style/numeric_literals.rb +14 -11
  32. data/lib/rubocop/cop/style/redundant_argument.rb +1 -1
  33. data/lib/rubocop/cop/style/redundant_condition.rb +2 -1
  34. data/lib/rubocop/cop/style/redundant_regexp_escape.rb +1 -1
  35. data/lib/rubocop/cop/style/sole_nested_conditional.rb +49 -3
  36. data/lib/rubocop/cop/style/symbol_proc.rb +5 -3
  37. data/lib/rubocop/core_ext/hash.rb +20 -0
  38. data/lib/rubocop/ext/regexp_node.rb +5 -10
  39. data/lib/rubocop/ext/regexp_parser.rb +2 -9
  40. data/lib/rubocop/version.rb +1 -1
  41. metadata +11 -7
@@ -20,18 +20,11 @@ module RuboCop
20
20
  module Expression
21
21
  # Add `expression` and `loc` to all `regexp_parser` nodes
22
22
  module Base
23
- attr_accessor :origin, :source
24
-
25
- def start_index
26
- # ts is a byte index; convert it to a character index
27
- @start_index ||= source.byteslice(0, ts).length
28
- end
23
+ attr_accessor :origin
29
24
 
30
25
  # Shortcut to `loc.expression`
31
26
  def expression
32
- @expression ||= begin
33
- origin.adjust(begin_pos: start_index, end_pos: start_index + full_length)
34
- end
27
+ @expression ||= origin.adjust(begin_pos: ts, end_pos: ts + full_length)
35
28
  end
36
29
 
37
30
  # @returns a location map like `parser` does, with:
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.4.2'
6
+ STRING = '1.5.0'
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, '\
9
9
  'rubocop-ast %<rubocop_ast_version>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: 1.4.2
4
+ version: 1.5.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: 2020-11-25 00:00:00.000000000 Z
13
+ date: 2020-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parallel
@@ -66,14 +66,14 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '1.8'
69
+ version: '2.0'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '1.8'
76
+ version: '2.0'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: rexml
79
79
  requirement: !ruby/object:Gem::Requirement
@@ -94,14 +94,14 @@ dependencies:
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 1.1.1
97
+ version: 1.2.0
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 1.1.1
104
+ version: 1.2.0
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: ruby-progressbar
107
107
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +183,7 @@ files:
183
183
  - lib/rubocop/cli/command/execute_runner.rb
184
184
  - lib/rubocop/cli/command/init_dotfile.rb
185
185
  - lib/rubocop/cli/command/show_cops.rb
186
+ - lib/rubocop/cli/command/suggest_extensions.rb
186
187
  - lib/rubocop/cli/command/version.rb
187
188
  - lib/rubocop/cli/environment.rb
188
189
  - lib/rubocop/comment_config.rb
@@ -426,6 +427,7 @@ files:
426
427
  - lib/rubocop/cop/lint/top_level_return_with_argument.rb
427
428
  - lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb
428
429
  - lib/rubocop/cop/lint/underscore_prefixed_variable_name.rb
430
+ - lib/rubocop/cop/lint/unexpected_block_arity.rb
429
431
  - lib/rubocop/cop/lint/unified_integer.rb
430
432
  - lib/rubocop/cop/lint/unmodified_reduce_accumulator.rb
431
433
  - lib/rubocop/cop/lint/unreachable_code.rb
@@ -454,6 +456,7 @@ files:
454
456
  - lib/rubocop/cop/metrics/utils/abc_size_calculator.rb
455
457
  - lib/rubocop/cop/metrics/utils/code_length_calculator.rb
456
458
  - lib/rubocop/cop/metrics/utils/iterating_block.rb
459
+ - lib/rubocop/cop/metrics/utils/repeated_attribute_discount.rb
457
460
  - lib/rubocop/cop/metrics/utils/repeated_csend_discount.rb
458
461
  - lib/rubocop/cop/migration/department_name.rb
459
462
  - lib/rubocop/cop/mixin/alignment.rb
@@ -764,6 +767,7 @@ files:
764
767
  - lib/rubocop/cop/variable_force/variable.rb
765
768
  - lib/rubocop/cop/variable_force/variable_table.rb
766
769
  - lib/rubocop/cops_documentation_generator.rb
770
+ - lib/rubocop/core_ext/hash.rb
767
771
  - lib/rubocop/core_ext/string.rb
768
772
  - lib/rubocop/directive_comment.rb
769
773
  - lib/rubocop/error.rb
@@ -819,7 +823,7 @@ metadata:
819
823
  homepage_uri: https://rubocop.org/
820
824
  changelog_uri: https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md
821
825
  source_code_uri: https://github.com/rubocop-hq/rubocop/
822
- documentation_uri: https://docs.rubocop.org/rubocop/1.4/
826
+ documentation_uri: https://docs.rubocop.org/rubocop/1.5/
823
827
  bug_tracker_uri: https://github.com/rubocop-hq/rubocop/issues
824
828
  post_install_message:
825
829
  rdoc_options: []