runger_style 5.14.1 → 5.15.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +12 -12
- data/lib/runger_style/cops/default/first_argument_indentation.rb +3 -3
- data/lib/runger_style/cops/default/if_unless_modifier.rb +61 -0
- data/lib/runger_style/cops/default/monkeypatches/multiline_element_line_breaks.rb +9 -9
- data/lib/runger_style/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b261788e883af277fc7cc22ce3c029aafbe7fd94300b10acb7f64b89d74d2b3c
|
|
4
|
+
data.tar.gz: 90c37f8193b959a0bec4d69ec93988018d887714fc55e6bedc37fda9fe9cabe4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 487ec712ac16381556f82fb6350bae553b7889b21ec25034e47ca599181d96d056a71e9911b9709f0fb2867064a1ab24568dd04a64cf70df95909344324cdb2f
|
|
7
|
+
data.tar.gz: bd4ef0b1a88b48e26c0d43dd4cf28168000b98c78e68ddb0ed6bbd367a9f3d9187b25a1b0298053a578f859f871c50156d1d4887d29df66574552f49e14d691b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
## Unreleased
|
|
2
2
|
[no unreleased changes yet]
|
|
3
3
|
|
|
4
|
+
## v5.15.0 (2026-08-20)
|
|
5
|
+
- [default] Add `RungerStyle/IfUnlessModifier` to prohibit trailing `if` and `unless` conditions.
|
|
6
|
+
|
|
4
7
|
## v5.14.1 (2026-08-13)
|
|
5
8
|
- [default] Enforce fixed continuation indentation for parenthesis-free macro calls.
|
|
6
9
|
|
data/Gemfile.lock
CHANGED
|
@@ -10,7 +10,7 @@ GIT
|
|
|
10
10
|
PATH
|
|
11
11
|
remote: .
|
|
12
12
|
specs:
|
|
13
|
-
runger_style (5.
|
|
13
|
+
runger_style (5.15.0)
|
|
14
14
|
prism (>= 0.24.0)
|
|
15
15
|
rubocop (>= 1.72.0)
|
|
16
16
|
|
|
@@ -69,10 +69,10 @@ GEM
|
|
|
69
69
|
method_source (~> 1.0)
|
|
70
70
|
reline (>= 0.6.0)
|
|
71
71
|
racc (1.8.1)
|
|
72
|
-
rack (3.2.
|
|
72
|
+
rack (3.2.7)
|
|
73
73
|
rainbow (3.1.1)
|
|
74
74
|
rake (13.4.2)
|
|
75
|
-
rbs (4.1.
|
|
75
|
+
rbs (4.1.3)
|
|
76
76
|
logger
|
|
77
77
|
prism (>= 1.6.0)
|
|
78
78
|
tsort
|
|
@@ -119,15 +119,15 @@ GEM
|
|
|
119
119
|
rubocop-factory_bot (2.28.0)
|
|
120
120
|
lint_roller (~> 1.1)
|
|
121
121
|
rubocop (~> 1.72, >= 1.72.1)
|
|
122
|
-
rubocop-performance (1.
|
|
122
|
+
rubocop-performance (1.27.0)
|
|
123
123
|
lint_roller (~> 1.1)
|
|
124
|
-
rubocop (>= 1.
|
|
124
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
125
125
|
rubocop-ast (>= 1.47.1, < 2.0)
|
|
126
|
-
rubocop-rails (2.
|
|
126
|
+
rubocop-rails (2.37.0)
|
|
127
127
|
activesupport (>= 4.2.0)
|
|
128
128
|
lint_roller (~> 1.1)
|
|
129
129
|
rack (>= 1.1)
|
|
130
|
-
rubocop (>= 1.
|
|
130
|
+
rubocop (>= 1.89.0, < 2.0)
|
|
131
131
|
rubocop-ast (>= 1.44.0, < 2.0)
|
|
132
132
|
rubocop-rake (0.7.1)
|
|
133
133
|
lint_roller (~> 1.1)
|
|
@@ -210,10 +210,10 @@ CHECKSUMS
|
|
|
210
210
|
pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
|
|
211
211
|
pry-byebug (3.10.1)
|
|
212
212
|
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
213
|
-
rack (3.2.
|
|
213
|
+
rack (3.2.7) sha256=93e13e1c24f93556671d85d2d79fa228c3485815c50d7e2f265b5330c6528fb7
|
|
214
214
|
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
215
215
|
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
216
|
-
rbs (4.1.
|
|
216
|
+
rbs (4.1.3) sha256=0c4474a9751cdc14364bfad0b3e53678323bbdc2c31683b0445932867dbab8c4
|
|
217
217
|
rdoc (8.0.0) sha256=03bf8c08a9639658855a0cfd77c0abca8325c227693f7f33f82957811348c469
|
|
218
218
|
readline (0.0.4) sha256=6138eef17be2b98298b672c3ea63bf9cb5158d401324f26e1e84f235879c1d6a
|
|
219
219
|
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
|
|
@@ -227,15 +227,15 @@ CHECKSUMS
|
|
|
227
227
|
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
|
|
228
228
|
rubocop-capybara (3.0.0) sha256=7a64655238acda7f8f3c87e37ac825a64c615a79c17c253f1a28270dc3768c4b
|
|
229
229
|
rubocop-factory_bot (2.28.0) sha256=4b17fc02124444173317e131759d195b0d762844a71a29fe8139c1105d92f0cb
|
|
230
|
-
rubocop-performance (1.
|
|
231
|
-
rubocop-rails (2.
|
|
230
|
+
rubocop-performance (1.27.0) sha256=eeeb1374d062a368ee1c787b70eb0b0cc4b184cb1f8565f424760946146d61ce
|
|
231
|
+
rubocop-rails (2.37.0) sha256=6e1645add5060e0328f8ddda0d820f55697c591394398bf14bb9dccb62f14b7e
|
|
232
232
|
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
|
|
233
233
|
rubocop-rspec (3.10.2) sha256=0b3e2ecc592cd10ecbf0095bb58d1e357905276e069643523cc19eb7495f65e2
|
|
234
234
|
rubocop-rspec_rails (2.32.0) sha256=4a0d641c72f6ebb957534f539d9d0a62c47abd8ce0d0aeee1ef4701e892a9100
|
|
235
235
|
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
236
236
|
runger_byebug (11.4.0) sha256=569e22ba2215f57e7f69e145fcb63be401e29fcd312f7936d813e12d0c7bbee6
|
|
237
237
|
runger_release_assistant (4.3.1) sha256=3246c925240739eb12b9e6b9526a77ea00fcf0a0941441ff5ffacefb7e3e4d83
|
|
238
|
-
runger_style (5.
|
|
238
|
+
runger_style (5.15.0)
|
|
239
239
|
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
240
240
|
slop (4.10.1) sha256=844322b5ffcf17ed4815fdb173b04a20dd82b4fd93e3744c88c8fafea696d9c7
|
|
241
241
|
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
module RungerStyle # rubocop:disable Style/ClassAndModuleChildren
|
|
4
4
|
class FirstArgumentIndentation < ::RuboCop::Cop::Layout::FirstArgumentIndentation
|
|
5
5
|
def on_send(node)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
unless memoizing?(node)
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
private
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RungerStyle # rubocop:disable Style/ClassAndModuleChildren
|
|
4
|
+
class IfUnlessModifier < ::RuboCop::Cop::Base
|
|
5
|
+
extend ::RuboCop::Cop::AutoCorrector
|
|
6
|
+
include ::RuboCop::Cop::RangeHelp
|
|
7
|
+
|
|
8
|
+
MSG = 'Use a multiline conditional instead of a trailing `%<keyword>s` condition.'
|
|
9
|
+
|
|
10
|
+
def on_if(node)
|
|
11
|
+
if node.modifier_form?
|
|
12
|
+
comment = trailing_comment(node)
|
|
13
|
+
|
|
14
|
+
add_offense(node.loc.keyword, message: format(MSG, keyword: node.keyword)) do |corrector|
|
|
15
|
+
corrector.replace(node, replacement(node, comment))
|
|
16
|
+
|
|
17
|
+
if comment
|
|
18
|
+
corrector.remove(trailing_comment_range(node, comment))
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def replacement(node, comment)
|
|
27
|
+
indentation = node.source_range.source_line[/^\s*/]
|
|
28
|
+
|
|
29
|
+
<<~RUBY.chomp
|
|
30
|
+
#{node.keyword} #{node.condition.source}#{comment_suffix(comment)}
|
|
31
|
+
#{indented_body(node, indentation)}
|
|
32
|
+
#{indentation}end
|
|
33
|
+
RUBY
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def indented_body(node, indentation)
|
|
37
|
+
node.body.source.lines.map.with_index do |line, index|
|
|
38
|
+
index.zero? ? "#{indentation} #{line}" : " #{line}"
|
|
39
|
+
end.join
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def trailing_comment(node)
|
|
43
|
+
processed_source.comments.find do |comment|
|
|
44
|
+
comment.location.line == node.last_line &&
|
|
45
|
+
comment.source_range.begin_pos >= node.source_range.end_pos
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def comment_suffix(comment)
|
|
50
|
+
if comment
|
|
51
|
+
" #{comment.source}"
|
|
52
|
+
else
|
|
53
|
+
''
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def trailing_comment_range(node, comment)
|
|
58
|
+
range_between(node.source_range.end_pos, comment.source_range.end_pos)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -4,16 +4,16 @@ module RungerStyle::MultilineElementLineBreaksPatches
|
|
|
4
4
|
private
|
|
5
5
|
|
|
6
6
|
def check_line_breaks(node, children, ignore_last: false)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
unless single_line?(node, children, ignore_last:)
|
|
8
|
+
last_seen_line = -1
|
|
9
|
+
children.each do |child|
|
|
10
|
+
if last_seen_line >= child.first_line
|
|
11
|
+
add_offense(child) do |corrector|
|
|
12
|
+
RuboCop::Cop::EmptyLineCorrector.insert_before(corrector, child)
|
|
13
|
+
end
|
|
14
|
+
else
|
|
15
|
+
last_seen_line = child.last_line
|
|
14
16
|
end
|
|
15
|
-
else
|
|
16
|
-
last_seen_line = child.last_line
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
data/lib/runger_style/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runger_style
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Runger
|
|
@@ -70,6 +70,7 @@ files:
|
|
|
70
70
|
- lib/runger_style/cops/capybara/require_all_custom_cops.rb
|
|
71
71
|
- lib/runger_style/cops/default/argument_alignment.rb
|
|
72
72
|
- lib/runger_style/cops/default/first_argument_indentation.rb
|
|
73
|
+
- lib/runger_style/cops/default/if_unless_modifier.rb
|
|
73
74
|
- lib/runger_style/cops/default/monkeypatches/multiline_element_line_breaks.rb
|
|
74
75
|
- lib/runger_style/cops/default/monkeypatches/multiline_expression_indentation.rb
|
|
75
76
|
- lib/runger_style/cops/default/multiline_hash_value_indentation.rb
|