betterlint 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/cop/betterment/hardcoded_id.rb +1 -1
- data/lib/rubocop/cop/betterment/site_prism_loaded.rb +2 -2
- data/lib/rubocop/cop/betterment/utils/hardcoded_attribute.rb +1 -1
- data/lib/rubocop/cop/betterment/vague_serialize.rb +21 -0
- data/lib/rubocop/cop/betterment.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d33fd3ef06ee7f731fa4e879cc87429f7d7e833e0687a761439628ccb4424922
|
4
|
+
data.tar.gz: 690aa6d3a567b3718a5ae7bb6d354d3cd1162cd15ff9d069dba24cbaba9f4318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a5a1cffd033ed6b46008c0e72b3a2d81d003d99138cb22b85fcbac76b60972ab55db3a8d61e50f7735c5f14c5958038e2748dfbd41d335e097a9f2eb63a24a2
|
7
|
+
data.tar.gz: 57b13761e63538931f32e4c55aceececca5a7c579b4318cb39881c7c090765361b00848bb884d9360c4bca5928be4221eb5d21982ebbe272c7209e422da63c1c
|
@@ -11,12 +11,12 @@ module RuboCop
|
|
11
11
|
def on_send(node)
|
12
12
|
return unless be_displayed_call?(node)
|
13
13
|
|
14
|
-
add_offense(node, location: node.children[2].
|
14
|
+
add_offense(node, location: node.children[2].source_range)
|
15
15
|
end
|
16
16
|
|
17
17
|
def autocorrect(node)
|
18
18
|
lambda do |corrector|
|
19
|
-
corrector.replace(node.children[2].
|
19
|
+
corrector.replace(node.children[2].source_range, 'be_loaded')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -41,7 +41,7 @@ module RuboCop
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def create_range(node, match)
|
44
|
-
range = node.
|
44
|
+
range = node.source_range
|
45
45
|
begin_pos = range.begin_pos + match.begin(0)
|
46
46
|
end_pos = range.begin_pos + match.end(0)
|
47
47
|
range.with(begin_pos: begin_pos, end_pos: end_pos)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RuboCop
|
2
|
+
module Cop
|
3
|
+
module Betterment
|
4
|
+
class VagueSerialize < Base
|
5
|
+
MSG = 'Active Record models with serialized columns should specify which ' \
|
6
|
+
'deserializer to use instead of falling back to the default.'.freeze
|
7
|
+
|
8
|
+
# @!method serialize?(node)
|
9
|
+
def_node_matcher :serialize?, <<-PATTERN
|
10
|
+
(send nil? :serialize ...)
|
11
|
+
PATTERN
|
12
|
+
|
13
|
+
def on_send(node)
|
14
|
+
return unless serialize? node
|
15
|
+
|
16
|
+
add_offense(node) if node.arguments.length < 2 || !node.arguments[1].const_type?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,3 +16,4 @@ require 'rubocop/cop/betterment/active_job_performable'
|
|
16
16
|
require 'rubocop/cop/betterment/allowlist_blocklist'
|
17
17
|
require 'rubocop/cop/betterment/server_error_assertion'
|
18
18
|
require 'rubocop/cop/betterment/hardcoded_id'
|
19
|
+
require 'rubocop/cop/betterment/vague_serialize'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/rubocop/cop/betterment/utils/hardcoded_attribute.rb
|
109
109
|
- lib/rubocop/cop/betterment/utils/method_return_table.rb
|
110
110
|
- lib/rubocop/cop/betterment/utils/parser.rb
|
111
|
+
- lib/rubocop/cop/betterment/vague_serialize.rb
|
111
112
|
homepage:
|
112
113
|
licenses:
|
113
114
|
- MIT
|
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
- !ruby/object:Gem::Version
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
132
|
+
rubygems_version: 3.2.32
|
132
133
|
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: Betterment rubocop configuration
|