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 +4 -4
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +10 -0
- data/lib/rubocop/cop/lint/literal_as_condition.rb +5 -0
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +1 -0
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +6 -1
- data/lib/rubocop/cop/style/hash_except.rb +1 -1
- data/lib/rubocop/formatter/simple_text_formatter.rb +2 -0
- data/lib/rubocop/formatter.rb +21 -21
- data/lib/rubocop/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e6cb927ae20cdc9cc2258d8f57b483c0fad68f03563e4f4a1823070510c8fac
|
4
|
+
data.tar.gz: 68a3e3f99f11ef787da421d67a2674027c425978e494fd7ab6c1ea0a614748df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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) &&
|
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)
|
data/lib/rubocop/formatter.rb
CHANGED
@@ -2,30 +2,30 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Formatter
|
5
|
-
|
6
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
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
|
data/lib/rubocop/version.rb
CHANGED
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.
|
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-
|
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.
|
988
|
+
rubygems_version: 3.2.22
|
975
989
|
signing_key:
|
976
990
|
specification_version: 4
|
977
991
|
summary: Automatic Ruby code style checking tool.
|