rubocop-discourse 3.9.2 → 3.9.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4003717b78bca02f538f48bc23fdd1b0e913bb6816c5d6a1e87401c53c167a14
|
4
|
+
data.tar.gz: acba524c9e7e399a5b69974ce94dfefa33fbd61c5c2197ecb425b1ed22418e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd47066d7d8066da4adb2f17d95de3420fbaae18599d07925671a28c58a95a2d39b4ba8319813a0daf2106e7ecce4407a99470a93f2d99f335147bad3142269
|
7
|
+
data.tar.gz: 311df91f7d4cf9b5e296d3dcbf625482a0fdea6ac1da33fe389b7db41ec0339b4918434ce97a13c023ba86e3a54eb81edcb512aba7cb9abd0a21b19bb5b5527d
|
@@ -53,7 +53,7 @@ module RuboCop
|
|
53
53
|
def on_block(node)
|
54
54
|
return unless service?
|
55
55
|
return unless top_level_block?(node)
|
56
|
-
return if node.single_line?
|
56
|
+
return if node.single_line? || single_block?(node)
|
57
57
|
|
58
58
|
if missing_empty_lines?(node)
|
59
59
|
add_offense(node, message: MSG) do |corrector|
|
@@ -78,6 +78,10 @@ module RuboCop
|
|
78
78
|
|
79
79
|
private
|
80
80
|
|
81
|
+
def single_block?(node)
|
82
|
+
!node.ancestors.first.begin_type?
|
83
|
+
end
|
84
|
+
|
81
85
|
def service?
|
82
86
|
@service
|
83
87
|
end
|
data/rubocop-discourse.gemspec
CHANGED
@@ -128,6 +128,23 @@ RSpec.describe RuboCop::Cop::Discourse::Services::EmptyLinesAroundBlocks,
|
|
128
128
|
end
|
129
129
|
|
130
130
|
context "when blocks are nested" do
|
131
|
+
context "when there is just one nested block" do
|
132
|
+
it "does not register an offense" do
|
133
|
+
expect_no_offenses(<<~RUBY)
|
134
|
+
class MyService
|
135
|
+
include Service::Base
|
136
|
+
|
137
|
+
transaction do
|
138
|
+
try do
|
139
|
+
step :first_step
|
140
|
+
step :second_step
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
RUBY
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
131
148
|
context "when the nested block is in the first position" do
|
132
149
|
context "when there is no empty line before" do
|
133
150
|
it "does not register an offense" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-discourse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.9.
|
4
|
+
version: 3.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Discourse Team
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-31 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|