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: bfb9c60dfc813cddff8b72b3f19b337ec3a6570f6210398841ed3852d9dcfad1
4
- data.tar.gz: 4d026033a03b8f08ccf51e9503cd83c0266132e677478732b64b4fdbe664b02a
3
+ metadata.gz: 70f7044795da60c3d19962181ad6e9bc1914c1ae9c46f5072f4c2bc9c6115add
4
+ data.tar.gz: d1130053b86d468d25b114694dca3d56eea533aafdbff9ff8dc33f3fdc306fbb
5
5
  SHA512:
6
- metadata.gz: 1fbc8870d37ee91a53e15f1d067517f8430cd9a0bb383bf27c80c4f84db32ded964c3f345caa6d026aaba187f3e7c78d6a838824433b16d3e9cac9ed7ecd337c
7
- data.tar.gz: 0cf8c155c3b987a10f581d4983240696fa444d7157e54e4bb2d2ac616721e80a4dacd264e32d15a0165e66d7d1511d97b9c8a07d4e94e1e41accfc71b7803228
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.load_file('config/database.yml')
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 = range_between(node.receiver.loc.selector.begin_pos, node.loc.selector.end_pos)
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
 
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Rails
5
5
  # This module holds the RuboCop Rails version information.
6
6
  module Version
7
- STRING = '2.11.1'
7
+ STRING = '2.11.2'
8
8
 
9
9
  def self.document_version
10
10
  STRING.match('\d+\.\d+').to_s
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.1
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-06-25 00:00:00.000000000 Z
13
+ date: 2021-07-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport