rubocop 1.31.0 → 1.31.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce713e2a82b2cedb9ee589f23d263234dfd7998fbeb1efd1bcaa7cd41fcd9c41
4
- data.tar.gz: e60ca60484e5093ee4d266a0041c0f6b5a501fe693ace1969b9d6fb423c46d1e
3
+ metadata.gz: 3e6cb927ae20cdc9cc2258d8f57b483c0fad68f03563e4f4a1823070510c8fac
4
+ data.tar.gz: 68a3e3f99f11ef787da421d67a2674027c425978e494fd7ab6c1ea0a614748df
5
5
  SHA512:
6
- metadata.gz: fbce1782b8cc7ec39ba95110a4d3feaacd66f73c6aadf572da79c6ca35af0f1339341adfa9a4765056d32e42759c206037153a94619f99ffeade552e43cbd016
7
- data.tar.gz: b93cb01f0f1e53302c61bc45ad1d680d89c5e338539aa084b59d072af27dc4eb7b74da88dc05512f879f0277eeaa8e84950fd55fbfcc5d0144eba7be7134df3b
6
+ metadata.gz: 991b16c032399b14752c8a71ad92d3e2000c57941eafdace759cc5cb4f7a8f18dc58952597575375cb2a7df425ffffd1e2b029dabc9d98834c5142cc38435382
7
+ data.tar.gz: f92f9b6704829816959e3ccd8c61fa439dfd75cbc09a145028de9d8cae2a636946da775b49e35a7b42a78d9af288969e72afaeb1b2fd47235a9e83201cdf4df7
@@ -32,10 +32,14 @@ module RuboCop
32
32
  extend AutoCorrector
33
33
 
34
34
  def on_new_investigation
35
+ last_line = last_line(processed_source)
36
+
35
37
  @ignored_ranges = string_literal_ranges(processed_source.ast) +
36
38
  comment_ranges(processed_source.comments)
37
39
 
38
40
  processed_source.raw_source.lines.each_with_index do |line, index|
41
+ break if index >= last_line
42
+
39
43
  line_number = index + 1
40
44
  investigate(line, line_number)
41
45
  end
@@ -103,6 +107,12 @@ module RuboCop
103
107
  comments.map(&:loc).map(&:expression)
104
108
  end
105
109
 
110
+ def last_line(processed_source)
111
+ last_token = processed_source.tokens.last
112
+
113
+ last_token ? last_token.line : processed_source.lines.length
114
+ end
115
+
106
116
  def ignore_range?(backtick_range)
107
117
  @ignored_ranges.any? { |range| range.contains?(backtick_range) }
108
118
  end
@@ -7,6 +7,9 @@ module RuboCop
7
7
  # operands in and/or expressions serving as the conditions of
8
8
  # if/while/until/case-when/case-in.
9
9
  #
10
+ # NOTE: Literals in `case-in` condition where the match variable is used in
11
+ # `in` are accepted as a pattern matching.
12
+ #
10
13
  # @example
11
14
  #
12
15
  # # bad
@@ -69,6 +72,8 @@ module RuboCop
69
72
 
70
73
  def on_case_match(case_match_node)
71
74
  if case_match_node.condition
75
+ return if case_match_node.descendants.any?(&:match_var_type?)
76
+
72
77
  check_case(case_match_node)
73
78
  else
74
79
  case_match_node.each_in_pattern do |in_pattern_node|
@@ -72,6 +72,7 @@ module RuboCop
72
72
 
73
73
  def on_send(node)
74
74
  return unless node.parent&.if_type?
75
+ return if node.parent.else_branch
75
76
  return if explicit_not_force?(node)
76
77
  return unless (exist_node = send_exist_node(node.parent).first)
77
78
  return unless exist_node.first_argument == node.first_argument
@@ -51,7 +51,8 @@ module RuboCop
51
51
  return [left_brace.column, :left_brace_or_bracket] if style == brace_alignment_style
52
52
 
53
53
  pair = hash_pair_where_value_beginning_with(left_brace)
54
- if pair && key_and_value_begin_on_same_line?(pair) && pair.right_sibling
54
+ if pair && key_and_value_begin_on_same_line?(pair) &&
55
+ right_sibling_begins_on_subsequent_line?(pair)
55
56
  return [pair.loc.column, :parent_hash_key]
56
57
  end
57
58
 
@@ -79,6 +80,10 @@ module RuboCop
79
80
  same_line?(pair.key, pair.value)
80
81
  end
81
82
 
83
+ def right_sibling_begins_on_subsequent_line?(pair)
84
+ pair.right_sibling && (pair.last_line < pair.right_sibling.first_line)
85
+ end
86
+
82
87
  def detected_styles(actual_column, offset, left_parenthesis, left_brace)
83
88
  base_column = actual_column - configured_indentation_width - offset
84
89
  detected_styles_for_column(base_column, left_parenthesis, left_brace)
@@ -144,7 +144,7 @@ module RuboCop
144
144
  return key.join(', ')
145
145
  end
146
146
 
147
- key.source
147
+ key.literal? ? key.source : "*#{key.source}"
148
148
  end
149
149
 
150
150
  def decorate_source(value)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'colorizable'
4
+
3
5
  module RuboCop
4
6
  module Formatter
5
7
  # A basic formatter that displays only files with offenses.
@@ -2,30 +2,30 @@
2
2
 
3
3
  module RuboCop
4
4
  module Formatter
5
- autoload :BaseFormatter, 'rubocop/formatter/base_formatter'
6
- autoload :SimpleTextFormatter, 'rubocop/formatter/simple_text_formatter'
5
+ require_relative 'formatter/text_util'
6
+
7
+ require_relative 'formatter/base_formatter'
8
+ require_relative 'formatter/simple_text_formatter'
7
9
  # relies on simple text
8
- autoload :ClangStyleFormatter, 'rubocop/formatter/clang_style_formatter'
9
- autoload :DisabledConfigFormatter, 'rubocop/formatter/disabled_config_formatter'
10
- autoload :EmacsStyleFormatter, 'rubocop/formatter/emacs_style_formatter'
11
- autoload :FileListFormatter, 'rubocop/formatter/file_list_formatter'
12
- autoload :FuubarStyleFormatter, 'rubocop/formatter/fuubar_style_formatter'
13
- autoload :GitHubActionsFormatter, 'rubocop/formatter/git_hub_actions_formatter'
14
- autoload :HTMLFormatter, 'rubocop/formatter/html_formatter'
15
- autoload :JSONFormatter, 'rubocop/formatter/json_formatter'
16
- autoload :JUnitFormatter, 'rubocop/formatter/junit_formatter'
17
- autoload :MarkdownFormatter, 'rubocop/formatter/markdown_formatter'
18
- autoload :OffenseCountFormatter, 'rubocop/formatter/offense_count_formatter'
19
- autoload :ProgressFormatter, 'rubocop/formatter/progress_formatter'
20
- autoload :QuietFormatter, 'rubocop/formatter/quiet_formatter'
21
- autoload :TapFormatter, 'rubocop/formatter/tap_formatter'
22
- autoload :WorstOffendersFormatter, 'rubocop/formatter/worst_offenders_formatter'
23
- autoload :PacmanFormatter, 'rubocop/formatter/pacman_formatter'
10
+ require_relative 'formatter/clang_style_formatter'
11
+ require_relative 'formatter/disabled_config_formatter'
12
+ require_relative 'formatter/emacs_style_formatter'
13
+ require_relative 'formatter/file_list_formatter'
14
+ require_relative 'formatter/fuubar_style_formatter'
15
+ require_relative 'formatter/git_hub_actions_formatter'
16
+ require_relative 'formatter/html_formatter'
17
+ require_relative 'formatter/json_formatter'
18
+ require_relative 'formatter/junit_formatter'
19
+ require_relative 'formatter/markdown_formatter'
20
+ require_relative 'formatter/offense_count_formatter'
21
+ require_relative 'formatter/progress_formatter'
22
+ require_relative 'formatter/quiet_formatter'
23
+ require_relative 'formatter/tap_formatter'
24
+ require_relative 'formatter/worst_offenders_formatter'
25
+ require_relative 'formatter/pacman_formatter'
24
26
  # relies on progress formatter
25
- autoload :AutoGenConfigFormatter, 'rubocop/formatter/auto_gen_config_formatter'
26
- autoload :Colorizable, 'rubocop/formatter/colorizable'
27
+ require_relative 'formatter/auto_gen_config_formatter'
27
28
 
28
29
  require_relative 'formatter/formatter_set'
29
- require_relative 'formatter/text_util'
30
30
  end
31
31
  end
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '1.31.0'
6
+ STRING = '1.31.1'
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.31.0
4
+ version: 1.31.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,8 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-06-27 00:00:00.000000000 Z
13
+ date: 2022-06-29 00:00:00.000000000 Z
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '2.3'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '2.3'
15
29
  - !ruby/object:Gem::Dependency
16
30
  name: parallel
17
31
  requirement: !ruby/object:Gem::Requirement
@@ -971,7 +985,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
971
985
  - !ruby/object:Gem::Version
972
986
  version: '0'
973
987
  requirements: []
974
- rubygems_version: 3.1.2
988
+ rubygems_version: 3.2.22
975
989
  signing_key:
976
990
  specification_version: 4
977
991
  summary: Automatic Ruby code style checking tool.