salsify_rubocop 1.85.1 → 1.85.3
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/.circleci/config.yml +5 -8
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/conf/rubocop_without_rspec.yml +2 -2
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/salsify/delayed_job_self_enqueue.rb +42 -0
- data/lib/rubocop/cop/salsify/rspec_dot_not_self_dot.rb +1 -1
- data/lib/salsify_rubocop/version.rb +1 -1
- data/lib/salsify_rubocop.rb +1 -0
- data/salsify_rubocop.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 041d08c08bd8b52a2f34f7eede60ffd0d4a10fa273677786f2c9ac55022a61ef
|
|
4
|
+
data.tar.gz: 9d81f7db9c1cc04c626c14ff254bbe63bb4bef0819ccf4814acedc252129ce8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8786955249fc8c36608315cb11dfbbd4ca306eae89e5a84df1589be6d4c8f38ff3e88053fd1bec186d34799c3576c27dd8216cfb7731ffa65a92c7670a89a59
|
|
7
|
+
data.tar.gz: 5109e5d059b580e0d1200270cc59fd4d245d4a71f1ca67ab40bf8e244a1d924b90cc40b6737bf1ae061a741cb778dace5e31f8f2983fccc7b495957fe6ec7474
|
data/.circleci/config.yml
CHANGED
|
@@ -2,14 +2,14 @@ version: 2.1
|
|
|
2
2
|
jobs:
|
|
3
3
|
lint:
|
|
4
4
|
docker:
|
|
5
|
-
- image: cimg/ruby:
|
|
5
|
+
- image: cimg/ruby:3.3.0
|
|
6
6
|
working_directory: ~/salsify_rubocop
|
|
7
7
|
steps:
|
|
8
8
|
- checkout
|
|
9
9
|
- restore_cache:
|
|
10
10
|
keys:
|
|
11
|
-
- v1-gems-ruby-
|
|
12
|
-
- v1-gems-ruby-
|
|
11
|
+
- v1-gems-ruby-3.3.0-{{ checksum "salsify_rubocop.gemspec" }}-{{ checksum "Gemfile" }}
|
|
12
|
+
- v1-gems-ruby-3.3.0-
|
|
13
13
|
- run:
|
|
14
14
|
name: Install Gems
|
|
15
15
|
command: |
|
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
bundle clean
|
|
20
20
|
fi
|
|
21
21
|
- save_cache:
|
|
22
|
-
key: v1-gems-ruby-
|
|
22
|
+
key: v1-gems-ruby-3.3.0-{{ checksum "salsify_rubocop.gemspec" }}-{{ checksum "Gemfile" }}
|
|
23
23
|
paths:
|
|
24
24
|
- "vendor/bundle"
|
|
25
25
|
- "gemfiles/vendor/bundle"
|
|
@@ -68,9 +68,6 @@ workflows:
|
|
|
68
68
|
matrix:
|
|
69
69
|
parameters:
|
|
70
70
|
ruby_version:
|
|
71
|
-
- "2.7.2"
|
|
72
|
-
- "3.0.0"
|
|
73
|
-
- "3.1.1"
|
|
74
|
-
- "3.2.0"
|
|
75
71
|
- "3.3.0"
|
|
72
|
+
- "3.4.0"
|
|
76
73
|
- "4.0.0"
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# salsify_rubocop
|
|
2
2
|
|
|
3
|
+
## 1.85.3
|
|
4
|
+
- Enable `Style/HashSyntax` with `EnforcedShorthandSyntax: always`.
|
|
5
|
+
Hashes whose keys match their values must now use shorthand
|
|
6
|
+
(`{ foo: }` rather than `{ foo: foo }`). Autocorrectable with
|
|
7
|
+
`rubocop -a`.
|
|
8
|
+
|
|
9
|
+
## 1.85.2
|
|
10
|
+
- Add `Salsify/DelayedJobSelfEnqueue` cop to detect `Delayed::Job.enqueue(self, ...)`, which serializes memoized AR objects and can cause `Delayed::DeserializationError` if those records are deleted before the job runs.
|
|
11
|
+
- Drop support for Ruby < 3.3
|
|
12
|
+
|
|
3
13
|
## 1.85.1
|
|
4
14
|
- Upgrade `rubocop` to v1.85.1.
|
|
5
15
|
|
|
@@ -234,9 +234,9 @@ Style/HashAsLastArrayItem:
|
|
|
234
234
|
Style/HashEachMethods:
|
|
235
235
|
Enabled: false
|
|
236
236
|
|
|
237
|
-
#
|
|
237
|
+
# Enforce the shorthand syntax where the key matches the value.
|
|
238
238
|
Style/HashSyntax:
|
|
239
|
-
EnforcedShorthandSyntax:
|
|
239
|
+
EnforcedShorthandSyntax: always
|
|
240
240
|
|
|
241
241
|
Style/OptionalBooleanParameter:
|
|
242
242
|
Enabled: false
|
data/config/default.yml
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module Salsify
|
|
6
|
+
# Detects `Delayed::Job.enqueue(self, ...)`.
|
|
7
|
+
#
|
|
8
|
+
# Re-enqueuing `self` serializes the entire object including memoized
|
|
9
|
+
# ActiveRecord instances. If any of those records are deleted before the
|
|
10
|
+
# job is next executed, deserialization will raise
|
|
11
|
+
# `Delayed::DeserializationError`. Create a fresh instance with only the
|
|
12
|
+
# primitive arguments instead.
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
#
|
|
16
|
+
# # bad
|
|
17
|
+
# Delayed::Job.enqueue(self, run_at: 5.minutes.from_now)
|
|
18
|
+
#
|
|
19
|
+
# # good
|
|
20
|
+
# new_job = self.class.new(arg_one: arg_one, arg_two: arg_two)
|
|
21
|
+
# Delayed::Job.enqueue(new_job, run_at: 5.minutes.from_now)
|
|
22
|
+
class DelayedJobSelfEnqueue < ::RuboCop::Cop::Base
|
|
23
|
+
MSG = 'Do not pass `self` to `Delayed::Job.enqueue`. ' \
|
|
24
|
+
'Create a new job instance to avoid serializing memoized AR objects.'
|
|
25
|
+
|
|
26
|
+
def_node_matcher :enqueue_self?, <<-PATTERN
|
|
27
|
+
(send
|
|
28
|
+
(const (const {nil? (cbase)} :Delayed) :Job)
|
|
29
|
+
:enqueue
|
|
30
|
+
self
|
|
31
|
+
...)
|
|
32
|
+
PATTERN
|
|
33
|
+
|
|
34
|
+
def on_send(node)
|
|
35
|
+
return unless enqueue_self?(node)
|
|
36
|
+
|
|
37
|
+
add_offense(node, message: MSG)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -20,7 +20,7 @@ module RuboCop
|
|
|
20
20
|
class RspecDotNotSelfDot < RuboCop::Cop::RSpec::Base
|
|
21
21
|
extend RuboCop::Cop::AutoCorrector
|
|
22
22
|
|
|
23
|
-
SELF_DOT_REGEXP = /["']self
|
|
23
|
+
SELF_DOT_REGEXP = /["']self\./
|
|
24
24
|
MSG = 'Use ".<class method>" instead of "self.<class method>" for example group description.'
|
|
25
25
|
|
|
26
26
|
def_node_matcher :example_group_match, <<-PATTERN
|
data/lib/salsify_rubocop.rb
CHANGED
data/salsify_rubocop.gemspec
CHANGED
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
31
|
spec.require_paths = ['lib']
|
|
32
32
|
|
|
33
|
-
spec.required_ruby_version = '>=
|
|
33
|
+
spec.required_ruby_version = '>= 3.3'
|
|
34
34
|
|
|
35
35
|
spec.add_development_dependency 'bundler'
|
|
36
36
|
spec.add_development_dependency 'rake', '~> 13.0'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: salsify_rubocop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.85.
|
|
4
|
+
version: 1.85.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Salsify, Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -160,6 +160,7 @@ files:
|
|
|
160
160
|
- conf/rubocop_rails50.yml
|
|
161
161
|
- conf/rubocop_without_rspec.yml
|
|
162
162
|
- config/default.yml
|
|
163
|
+
- lib/rubocop/cop/salsify/delayed_job_self_enqueue.rb
|
|
163
164
|
- lib/rubocop/cop/salsify/rails_application_mailer.rb
|
|
164
165
|
- lib/rubocop/cop/salsify/rails_application_serializer.rb
|
|
165
166
|
- lib/rubocop/cop/salsify/rails_unscoped.rb
|
|
@@ -184,14 +185,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
184
185
|
requirements:
|
|
185
186
|
- - ">="
|
|
186
187
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: '
|
|
188
|
+
version: '3.3'
|
|
188
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
requirements:
|
|
190
191
|
- - ">="
|
|
191
192
|
- !ruby/object:Gem::Version
|
|
192
193
|
version: '0'
|
|
193
194
|
requirements: []
|
|
194
|
-
rubygems_version: 3.
|
|
195
|
+
rubygems_version: 3.5.22
|
|
195
196
|
signing_key:
|
|
196
197
|
specification_version: 4
|
|
197
198
|
summary: Shared RuboCop configuration
|