rubocop-rails 2.11.1 → 2.11.2
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: 70f7044795da60c3d19962181ad6e9bc1914c1ae9c46f5072f4c2bc9c6115add
|
4
|
+
data.tar.gz: d1130053b86d468d25b114694dca3d56eea533aafdbff9ff8dc33f3fdc306fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49d18f985b54c2a8beefe8f00ad758b2cabed80d463315e10c994eeb348af4f1e6db1f53ac7a73434105d210db831b98ddb8f5ae44e849346888ff427c4eabcc
|
7
|
+
data.tar.gz: 291ad9f2cafe1c8ce146bf9e311e5bf84c667e087596050076d9fa560ef0612c41a425beb8d314386f98e4f2eeb4f31bdb50f134eebad52b44efca82ea4299ba
|
@@ -194,7 +194,11 @@ module RuboCop
|
|
194
194
|
def database_yaml
|
195
195
|
return nil unless File.exist?('config/database.yml')
|
196
196
|
|
197
|
-
yaml = YAML.
|
197
|
+
yaml = if YAML.respond_to?(:unsafe_load_file)
|
198
|
+
YAML.unsafe_load_file('config/database.yml')
|
199
|
+
else
|
200
|
+
YAML.load_file('config/database.yml')
|
201
|
+
end
|
198
202
|
return nil unless yaml.is_a? Hash
|
199
203
|
|
200
204
|
config = yaml['development']
|
@@ -32,10 +32,10 @@ module RuboCop
|
|
32
32
|
RESTRICT_ON_SEND = %i[first take].freeze
|
33
33
|
|
34
34
|
def on_send(node)
|
35
|
-
return unless where_method?(node.receiver)
|
35
|
+
return unless node.arguments.empty? && where_method?(node.receiver)
|
36
36
|
return if ignore_where_first? && node.method?(:first)
|
37
37
|
|
38
|
-
range =
|
38
|
+
range = offense_range(node)
|
39
39
|
|
40
40
|
add_offense(range, message: format(MSG, method: node.method_name)) do |corrector|
|
41
41
|
autocorrect(corrector, node)
|
@@ -51,6 +51,10 @@ module RuboCop
|
|
51
51
|
receiver.respond_to?(:method?) && receiver.method?(:where)
|
52
52
|
end
|
53
53
|
|
54
|
+
def offense_range(node)
|
55
|
+
range_between(node.receiver.loc.selector.begin_pos, node.loc.selector.end_pos)
|
56
|
+
end
|
57
|
+
|
54
58
|
def autocorrect(corrector, node)
|
55
59
|
return if node.method?(:first)
|
56
60
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bozhidar Batsov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|