rubocop-rails 2.21.0 → 2.21.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: 9de78b7956de6935004b845bb3a50ae7b751aa5b81abbc4feceb62ea20b9d3a7
4
- data.tar.gz: d8f7f57ae1cfe141e6082547f6ea40dbdc6d42f32c2e9f95ba4ec904baaeea7b
3
+ metadata.gz: 15c354794d638a6c49b01b74961ea1d55f5541f3a8b653ef68d9a824e042a100
4
+ data.tar.gz: 3a04d9449daac9515b0be93d1394b1aa260748ab6bc57517cf3b90217f58ec88
5
5
  SHA512:
6
- metadata.gz: e9b3366bdbfa5bd3a53715a3b7ab2fcc5ffd8a6e1eef1da7e557297a827f1caf92bdcfbd2c771e9ef384713d97a347d7f09e4ef792252f8e9900476f034a82ab
7
- data.tar.gz: cb54c3f8a7a8ca823055341f531ed2922138c73f101e1cf2455376902b15d545708ddf3c94a06e44146f765277fbdf49e080eb6db085edf438afbaa4a2f61cbc
6
+ metadata.gz: '01167387c8fcee795769724ded84c4eaa373e2d2d936e8a2b0afd5f4bcb239aafd299b1c302d5a029b7ae72f2990290f2f6de1d317d1cb163f707d5f0ee91635'
7
+ data.tar.gz: 61d8f93f138aceb3c8e7a8ef03604d5de870b8328e452d34c03f77612681e9846ac7a4f0ed127a48806bb2bfad055e6ccebe9d3393e82e0f4e01ea88a1d870a6
@@ -124,19 +124,20 @@ module RuboCop
124
124
  update_all
125
125
  where
126
126
  without
127
- ].freeze
127
+ ].to_set.freeze
128
128
 
129
- def on_send(node)
130
- query_node = node.parent
129
+ def_node_matcher :followed_by_query_method?, <<~PATTERN
130
+ (send (send _ :all) QUERYING_METHODS ...)
131
+ PATTERN
131
132
 
132
- return unless query_node&.send_type?
133
- return unless QUERYING_METHODS.include?(query_node.method_name)
133
+ def on_send(node)
134
+ return unless followed_by_query_method?(node.parent)
134
135
  return if node.receiver.nil? && !inherit_active_record_base?(node)
135
136
 
136
137
  range_of_all_method = node.loc.selector
137
138
  add_offense(range_of_all_method) do |collector|
138
139
  collector.remove(range_of_all_method)
139
- collector.remove(query_node.loc.dot)
140
+ collector.remove(node.parent.loc.dot)
140
141
  end
141
142
  end
142
143
  end
@@ -69,7 +69,7 @@ module RuboCop
69
69
  return if !node.receiver&.str_type? || !node.method?(:to_time)
70
70
 
71
71
  add_offense(node.loc.selector, message: MSG_STRING_TO_TIME) do |corrector|
72
- autocorrect(corrector, node)
72
+ corrector.replace(node, "Time.zone.parse(#{node.receiver.source})")
73
73
  end
74
74
  end
75
75
 
@@ -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.21.0'
7
+ STRING = '2.21.1'
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.21.0
4
+ version: 2.21.1
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: 2023-09-09 00:00:00.000000000 Z
13
+ date: 2023-09-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport