salsify_rubocop 1.74.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04d76544a5d6aae6ddd1154cee539489026224153120d314a9dd80fed6765be0
4
- data.tar.gz: 1a26b0238f38a29663ff1132140db522f63804efd0f62729e6a2b633d764af4a
3
+ metadata.gz: 041d08c08bd8b52a2f34f7eede60ffd0d4a10fa273677786f2c9ac55022a61ef
4
+ data.tar.gz: 9d81f7db9c1cc04c626c14ff254bbe63bb4bef0819ccf4814acedc252129ce8f
5
5
  SHA512:
6
- metadata.gz: a3826cfe3896c3bf4de2da7aed4f3a3ee3a9cabffd0f816fda262db7199365ae31c9b7cdcf861ef2cd52c059831c8e8ba20f259d5b9943010f2d42a8f3db34a0
7
- data.tar.gz: d60e9c9c926bc8ef3799008cadc98c92a70187d715975785e2d3a5564a89fb0f549f011d907d4502397532d1dde33472ecc30277055c740ac660f0680b04450a
6
+ metadata.gz: a8786955249fc8c36608315cb11dfbbd4ca306eae89e5a84df1589be6d4c8f38ff3e88053fd1bec186d34799c3576c27dd8216cfb7731ffa65a92c7670a89a59
7
+ data.tar.gz: 5109e5d059b580e0d1200270cc59fd4d245d4a71f1ca67ab40bf8e244a1d924b90cc40b6737bf1ae061a741cb778dace5e31f8f2983fccc7b495957fe6ec7474
data/.circleci/config.yml CHANGED
@@ -2,23 +2,24 @@ version: 2.1
2
2
  jobs:
3
3
  lint:
4
4
  docker:
5
- - image: cimg/ruby:2.7.7
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-2.7.7-{{ checksum "salsify_rubocop.gemspec" }}-{{ checksum "Gemfile" }}
12
- - v1-gems-ruby-2.7.7-
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: |
16
- if ! bundle check --path=vendor/bundle; then
17
- bundle install --path=vendor/bundle --jobs=4 --retry=3
16
+ bundle config set path 'vendor/bundle'
17
+ if ! bundle check; then
18
+ bundle install --jobs=4 --retry=3
18
19
  bundle clean
19
20
  fi
20
21
  - save_cache:
21
- key: v1-gems-ruby-2.6.6-{{ checksum "salsify_rubocop.gemspec" }}-{{ checksum "Gemfile" }}
22
+ key: v1-gems-ruby-3.3.0-{{ checksum "salsify_rubocop.gemspec" }}-{{ checksum "Gemfile" }}
22
23
  paths:
23
24
  - "vendor/bundle"
24
25
  - "gemfiles/vendor/bundle"
@@ -43,8 +44,9 @@ jobs:
43
44
  - run:
44
45
  name: Install Gems
45
46
  command: |
46
- if ! bundle check --path=vendor/bundle; then
47
- bundle install --path=vendor/bundle --jobs=4 --retry=3
47
+ bundle config set path 'vendor/bundle'
48
+ if ! bundle check; then
49
+ bundle install --jobs=4 --retry=3
48
50
  bundle clean
49
51
  fi
50
52
  - save_cache:
@@ -66,8 +68,6 @@ workflows:
66
68
  matrix:
67
69
  parameters:
68
70
  ruby_version:
69
- - "2.7.2"
70
- - "3.0.0"
71
- - "3.1.1"
72
- - "3.2.0"
73
71
  - "3.3.0"
72
+ - "3.4.0"
73
+ - "4.0.0"
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_from:
2
2
  - conf/rubocop.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.7
5
+ TargetRubyVersion: 3.3
6
6
 
7
7
  Layout/LineLength:
8
8
  Exclude:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
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
+
13
+ ## 1.85.1
14
+ - Upgrade `rubocop` to v1.85.1.
15
+
3
16
  ## 1.74.0
4
17
  - Upgrade `rubocop` to v1.74.0.
5
18
 
@@ -180,7 +180,7 @@ Metrics/CyclomaticComplexity:
180
180
  Layout/LineLength:
181
181
  Enabled: true
182
182
  Max: 120
183
- IgnoreCopDirectives: true
183
+ AllowCopDirectives: true
184
184
  AllowedPatterns:
185
185
  - ^#
186
186
 
@@ -234,9 +234,9 @@ Style/HashAsLastArrayItem:
234
234
  Style/HashEachMethods:
235
235
  Enabled: false
236
236
 
237
- # Allow both { foo: } and { foo: foo }
237
+ # Enforce the shorthand syntax where the key matches the value.
238
238
  Style/HashSyntax:
239
- EnforcedShorthandSyntax: either
239
+ EnforcedShorthandSyntax: always
240
240
 
241
241
  Style/OptionalBooleanParameter:
242
242
  Enabled: false
@@ -326,6 +326,9 @@ Style/QuotedSymbols:
326
326
  Style/RedundantInitialize:
327
327
  Enabled: false
328
328
 
329
+ Style/RedundantParentheses:
330
+ Enabled: false
331
+
329
332
  Style/RedundantSelfAssignmentBranch:
330
333
  Enabled: false
331
334
 
data/config/default.yml CHANGED
@@ -45,3 +45,8 @@ Salsify/StyleDig:
45
45
  Enabled: true
46
46
  AutoCorrect: false
47
47
 
48
+ Salsify/DelayedJobSelfEnqueue:
49
+ Description: 'Do not pass `self` to `Delayed::Job.enqueue` to avoid serializing memoized AR objects.'
50
+ Enabled: true
51
+ AutoCorrect: false
52
+
@@ -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\./.freeze
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SalsifyRubocop
4
- VERSION = '1.74.0'
4
+ VERSION = '1.85.3'
5
5
  end
@@ -25,3 +25,4 @@ require 'rubocop/cop/salsify/rspec_doc_string'
25
25
  require 'rubocop/cop/salsify/rspec_dot_not_self_dot'
26
26
  require 'rubocop/cop/salsify/rspec_string_literals'
27
27
  require 'rubocop/cop/salsify/style_dig'
28
+ require 'rubocop/cop/salsify/delayed_job_self_enqueue'
@@ -30,14 +30,14 @@ 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 = '>= 2.7'
33
+ spec.required_ruby_version = '>= 3.3'
34
34
 
35
- spec.add_development_dependency 'bundler', '~> 2.0'
35
+ spec.add_development_dependency 'bundler'
36
36
  spec.add_development_dependency 'rake', '~> 13.0'
37
37
  spec.add_development_dependency 'rspec', '~> 3.0'
38
38
  spec.add_development_dependency 'rspec_junit_formatter'
39
39
 
40
- spec.add_runtime_dependency 'rubocop', '~> 1.74.0'
40
+ spec.add_runtime_dependency 'rubocop', '~> 1.85.1'
41
41
  spec.add_runtime_dependency 'rubocop-performance', '~> 1.15.2'
42
42
  spec.add_runtime_dependency 'rubocop-rails', '~> 2.17.4'
43
43
  spec.add_runtime_dependency 'rubocop-rake', '~> 0.6.0'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salsify_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.74.0
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: 2025-03-25 00:00:00.000000000 Z
11
+ date: 2026-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.74.0
75
+ version: 1.85.1
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: 1.74.0
82
+ version: 1.85.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop-performance
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -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: '2.7'
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.3.26
195
+ rubygems_version: 3.5.22
195
196
  signing_key:
196
197
  specification_version: 4
197
198
  summary: Shared RuboCop configuration