rubocop-betterment 2.0.0.pre → 2.0.0.pre2
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: 43b05fbd08387b00251df695ed3c9de3bbd38592195ef2dbea370f637ca2acdd
|
4
|
+
data.tar.gz: 55dfe59749ca808f49b442d5a0634b959c0492db4386eccb64f3a0d8fdfbcc82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb9ebd2aa93032848cbf4e27ab8bb3e69c82f2047d788833c76fce9b2f811d184e2d72a6d1186b711de9ae0e3546e6dc0f40870890ccc908ba151ede6c50e9f
|
7
|
+
data.tar.gz: '0294e0f6655280cd462aae9da70e79d830be6879a9b2b5a529d352fba13b9c0d1221ead2c44045bd4a33dfbdc1cea108c3ee5b85d96b314349617249660d8018'
|
@@ -86,7 +86,7 @@ module RuboCop
|
|
86
86
|
|
87
87
|
# Flags objects being created/updated with unsafe
|
88
88
|
# params indirectly from params or through params.permit
|
89
|
-
def flag_indirect_param_use(node) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
|
89
|
+
def flag_indirect_param_use(node) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
90
90
|
name = Utils::Parser.get_root_token(node)
|
91
91
|
# extracted_params contains parameters used like:
|
92
92
|
# def create
|
@@ -115,8 +115,8 @@ module RuboCop
|
|
115
115
|
# def indirect_params
|
116
116
|
# params[:user_id]
|
117
117
|
# end
|
118
|
-
if ret.method?(:[])
|
119
|
-
internal_params = ret.arguments.map(&:value)
|
118
|
+
if ret.send_type? && ret.method?(:[])
|
119
|
+
internal_params = ret.arguments.select { |x| x.sym_type? || x.str_type? }.map(&:value)
|
120
120
|
else
|
121
121
|
internal_returns = Utils::MethodReturnTable.get_method(Utils::Parser.get_root_token(ret)) || []
|
122
122
|
internal_params = internal_returns.flat_map { |x| Utils::Parser.get_extracted_parameters(x, param_aliases: @param_wrappers) }
|
@@ -87,7 +87,11 @@ module RuboCop
|
|
87
87
|
parameter_names = []
|
88
88
|
param_aliases << :params
|
89
89
|
|
90
|
-
|
90
|
+
if node.method?(:[]) && param_aliases.include?(get_root_token(node))
|
91
|
+
return node.arguments.select { |x|
|
92
|
+
x.sym_type? || x.str_type?
|
93
|
+
}.map(&:value)
|
94
|
+
end
|
91
95
|
|
92
96
|
children = node.descendants.select do |child|
|
93
97
|
child.send_type? && param_aliases.include?(child.method_name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-betterment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|