betterlint 1.10.0 → 1.11.0
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: 7eb5c7ed26f89c821f0319b2c474bed54ea591ba5e3b131f980b03e877693855
|
4
|
+
data.tar.gz: fe1fe8ca996cca9fd3b6380c2360695a875d48c37ec1017064d92769349ca8a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31d148d653926781736d4725d66ddaec2e4c76502f51e5a43d61fb918744da04a8268b9afd8680506583b2621b91a0412adbf1f839873318c585a0e124b3a74a
|
7
|
+
data.tar.gz: a04c4263391347e8ffef907f86538a9732ce894e06283ba378d1e0adefb867f67776e5d5eb8e1c612ff0bb73252724ff1c8d4011e42bc29af964ae85a918b9fc
|
data/config/default.yml
CHANGED
@@ -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.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.62.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-graphql
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.5.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.5.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubocop-performance
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|