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 +4 -4
- data/README.md +12 -0
- data/lib/rubocop/cop/betterment/vague_serialize.rb +9 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abed62a3254c489777ae4372142ff0bf2a4c8201003619e5c10f0754a07f9eb8
|
4
|
+
data.tar.gz: 618bb3269cb0c584e94bd3fef3f6776b5e325e9bf63d5cfdc8737c3c3d5f33a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
16
|
-
|
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
|
-
|
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.
|
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:
|
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.
|
141
|
-
changelog_uri: https://github.com/Betterment/betterlint/blob/v1.
|
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.
|
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.
|
159
|
+
rubygems_version: 3.6.8
|
160
160
|
specification_version: 4
|
161
161
|
summary: Betterment rubocop configuration
|
162
162
|
test_files: []
|