betterlint 1.4.0 → 1.4.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: 412124b5950ac692bc3b555414eb9b46ff7632b0535baf7efd5cb16095c79e2f
4
- data.tar.gz: e75bb5528c7e82a76144e763796f2373f431ce027659a4321195526c11a0bd94
3
+ metadata.gz: 1e93a2bacb559d6455d9e1d7acf0ee3d34e378817b70ff2694d9c7dc5fd051c7
4
+ data.tar.gz: 8613c5d928bfa812f75e6092ddb201d7030cee8e9c27ded059487941628a6540
5
5
  SHA512:
6
- metadata.gz: 2e441d742d6c67abead8a74d052f579c0290d57aa5c77ae46b117273cb1bcae8c5fe06a02cad97c0582a67e2afe0b83a1a775b35e6d8564a486419a75a3afc10
7
- data.tar.gz: a756fb81d8747b7358f6f650c61b23092518e49d6166aefe5f7123810805a2df7d83878776b2f9a17db29a9ffee838c37ecca1783ce6563b01cdd0354e57db8d
6
+ metadata.gz: 3dc6e12bc99a8405a25f0902636087ef2f034641f161465c3b337f08ade4a916d3a92b6ec8a4e259afea53aebefe4068214dd2b3faf5bbf0473a4b3617289154
7
+ data.tar.gz: c8e15b4f85363fb9ade768e1e012b717a58e168040500639b053fd831a48133174ae67c33cd25229ea8eff885ac90b5228c0c4113be01e411f3f8f92fed35fb6
@@ -91,7 +91,7 @@ module RuboCop
91
91
  end
92
92
 
93
93
  def with_comma(attribute)
94
- range = attribute.location.expression
94
+ range = attribute.source_range
95
95
  range = range_with_surrounding_space(range: range)
96
96
  range_with_surrounding_comma(range, :left)
97
97
  end
@@ -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].loc.expression)
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].loc.expression, 'be_loaded')
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.loc.expression
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.0
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Development
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-28 00:00:00.000000000 Z
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '2.7'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '2.7'
83
83
  description: Betterment rubocop configuration
84
84
  email:
85
85
  - development@betterment.com
@@ -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.3.7
132
+ rubygems_version: 3.2.32
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: Betterment rubocop configuration