betterlint 1.10.0 → 1.10.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebad0e83ab9fb4d6fd1beb0c28ea03bbf593cd7d9831c5b2546f646b8622a449
|
4
|
+
data.tar.gz: c8c3b31f1b37f54fdd8ae8857ceb9f39f372e130b888541afab8beae78d60ccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743afd50991fd213f1ca6a4f311cc96c506c0f2dc76de117887756ec634b0ad1704e953a871c0f0280a25c7dba60194076fe262257b80364903ca56b6541f33d
|
7
|
+
data.tar.gz: c7ba0f48ee2e69d0590de7973922aeef331c48a6a79417bae84b05ff45c33217ffb8bd01f0814123ff22201c8e73a40c9a307879a377826951589beed966523f
|
@@ -17,11 +17,7 @@ module RuboCop
|
|
17
17
|
MSG
|
18
18
|
|
19
19
|
def on_def(node)
|
20
|
-
each_offense(node, :redirect_to)
|
21
|
-
add_offense(responder) do |corrector|
|
22
|
-
corrector.insert_after(responder, ", status: :see_other")
|
23
|
-
end
|
24
|
-
end
|
20
|
+
each_offense(node, :redirect_to) { :see_other }
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
@@ -18,9 +18,7 @@ module RuboCop
|
|
18
18
|
|
19
19
|
def on_def(node)
|
20
20
|
each_offense(node, :render) do |responder|
|
21
|
-
|
22
|
-
corrector.insert_after(responder, ", status: #{infer_status(responder).inspect}")
|
23
|
-
end
|
21
|
+
infer_status(responder)
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
@@ -11,15 +11,28 @@ module RuboCop
|
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
-
def each_offense(node, responder_name
|
15
|
-
|
16
|
-
|
14
|
+
def each_offense(node, responder_name)
|
15
|
+
return unless UNSAFE_ACTIONS.include?(node.method_name)
|
16
|
+
|
17
|
+
on_missing_status(node, responder_name) do |responder|
|
18
|
+
add_offense(responder) do |corrector|
|
19
|
+
status = yield(responder)
|
20
|
+
|
21
|
+
if responder.arguments?
|
22
|
+
corrector.insert_after(responder.last_argument, ", status: #{status.inspect}")
|
23
|
+
else
|
24
|
+
corrector.replace(responder, "#{responder_name} status: #{status.inspect}")
|
25
|
+
end
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
19
29
|
|
20
30
|
# @!method on_missing_status(node)
|
21
31
|
def_node_search :on_missing_status, <<~PATTERN
|
22
|
-
|
32
|
+
{
|
33
|
+
(send nil? %1)
|
34
|
+
(send nil? %1 ... !(hash <(pair (sym :status) _) ...>))
|
35
|
+
}
|
23
36
|
PATTERN
|
24
37
|
end
|
25
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|