betterlint 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25f8e840f59447c480bca9bb7c6ec070d1a6ef4cc5d784448bbaae92bc81e0ee
4
- data.tar.gz: 1aeef2d6f6c42e0967605a5dca2f69a43b58d7a4b705338956b392979c8fefe0
3
+ metadata.gz: abed62a3254c489777ae4372142ff0bf2a4c8201003619e5c10f0754a07f9eb8
4
+ data.tar.gz: 618bb3269cb0c584e94bd3fef3f6776b5e325e9bf63d5cfdc8737c3c3d5f33a2
5
5
  SHA512:
6
- metadata.gz: 4ed29d409e9038101e030a72bb736be26fa2687e8e2028be8b0fa25cddf49a768582c8fb04c546ebad0dcc4585a12705b9e0a94fa87fd81c7f381fd25f199fea
7
- data.tar.gz: 622fab9cfcf2b8aeb6bc6e3ccc0c13cb62ed473d282a498798a814e1227dbfb3893f71e089359de11af7a6c8ba92b2ae4ea25f3abd0cda162b20abe8d9fdb8c6
6
+ metadata.gz: 641573afe2d923b6c4a063c6ed7051792484750e8542171f9f39c499886101ef6cb1aee01790de96f2c5c16de514e063a3ede731b37b68c7afce23a13b8cd9cb
7
+ data.tar.gz: bf51c01eb160f348615a8a0ee57c3f5954e22b18547b41b93f4c54a2c6dcf6bd3b544c761c56a162e6514c49e85b285c379a0270faf234f5739ae9b905dbf1d5
data/README.md CHANGED
@@ -318,3 +318,15 @@ This allows us two benefits:
318
318
  This cop identifies associations where `:strict_loading` is set explicitly, and prefers that it be removed in favor of using the global strict loading settings.
319
319
 
320
320
  This is related to the [Betterment/UseGlobalStrictLoading/ByDefaultForModels](#bettermentuseglobalstrictloadingbydefaultformodels) cop, but allows for more granular enablement and disablement of associations within a model. The intention is similar, in that we are using this cop to help "burn down" code to strict load, but it allows us to focus on the per-association level. Some models may have quite a lot of usage, so enabling it for a model might cause thousands of failures in the specs. In those cases we will disable all the associations, and then work through them one at a time until all code that uses the model strict loads.
321
+
322
+ ### Betterment/VagueSerialize
323
+
324
+ This cop identifies calls to `serialize` that do not specify a coder either by using the positional argument or
325
+ the `coder` keyword argument.
326
+
327
+ **NOTE:** Using a positional argument is deprecated for Rails 7.1+. That means that...
328
+
329
+ - If you are on Rails 7.2
330
+ - And you've opted into 7.1 defaults (namely, `config.active_record.default_column_serializer = nil`)
331
+
332
+ ...you can safely disable this cop, since failing to pass a deserializer will raise an exception.
@@ -12,10 +12,16 @@ module RuboCop
12
12
  (send nil? :serialize ...)
13
13
  PATTERN
14
14
 
15
- def on_send(node)
16
- return unless serialize? node
15
+ # @!method kwargs_with_coder?(node)
16
+ def_node_matcher :kwargs_with_coder?, '(hash <(pair (sym :coder) const) ...>)'
17
+
18
+ # @!method valid_serialize?(node)
19
+ def_node_matcher :valid_serialize?, <<-PATTERN
20
+ (send nil? :serialize _ { const !#kwargs_with_coder?? | #kwargs_with_coder? })
21
+ PATTERN
17
22
 
18
- add_offense(node) if node.arguments.length < 2 || !node.arguments[1].const_type?
23
+ def on_send(node)
24
+ add_offense(node) if serialize?(node) && !valid_serialize?(node)
19
25
  end
20
26
  alias on_csend on_send
21
27
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterlint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Development
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rubocop
@@ -137,10 +137,10 @@ licenses:
137
137
  - MIT
138
138
  metadata:
139
139
  homepage_uri: https://github.com/Betterment/betterlint
140
- source_code_uri: https://github.com/Betterment/betterlint/tree/v1.21.0
141
- changelog_uri: https://github.com/Betterment/betterlint/blob/v1.21.0/CHANGELOG.md
140
+ source_code_uri: https://github.com/Betterment/betterlint/tree/v1.22.0
141
+ changelog_uri: https://github.com/Betterment/betterlint/blob/v1.22.0/CHANGELOG.md
142
142
  bug_tracker_uri: https://github.com/Betterment/betterlint/issues
143
- documentation_uri: https://www.rubydoc.info/gems/betterlint/1.21.0
143
+ documentation_uri: https://www.rubydoc.info/gems/betterlint/1.22.0
144
144
  rubygems_mfa_required: 'true'
145
145
  rdoc_options: []
146
146
  require_paths:
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.6.6
159
+ rubygems_version: 3.6.8
160
160
  specification_version: 4
161
161
  summary: Betterment rubocop configuration
162
162
  test_files: []