gl_rubocop 0.2.4 → 0.2.6
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/default.yml +4 -0
- data/lib/gl_rubocop/gl_cops/rails_cache.rb +24 -0
- data/lib/gl_rubocop/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc932e911296ebd58c3e59febe32b734287f3ac302762c807c7f2cf58cc1c3ea
|
4
|
+
data.tar.gz: 9e9a20252ffcf744d7c8faf367f53f355e07dfcd9d8cb20f29a7d28401c5fd42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1f6f481ca4275167ba6c630eaf558a83bd29cac26f6a777c8354dd0dff798c792f86eaded520dab8df616294cb6c0941477a2343abc4a13bdfa548bb021e7b7
|
7
|
+
data.tar.gz: 3ef8ba758032a3623ebfe92fbc3cef16b4736b78e0875051ef1f158131f78bbf5b1cb8933ea12c78d4beb103c86d525e3f4ddd607e19d03cc69ea3bc331290d9
|
data/default.yml
CHANGED
@@ -7,6 +7,7 @@ require:
|
|
7
7
|
- ./lib/gl_rubocop/gl_cops/interactor_inherits_from_interactor_base.rb
|
8
8
|
- ./lib/gl_rubocop/gl_cops/callback_method_names.rb
|
9
9
|
- ./lib/gl_rubocop/gl_cops/prevent_erb_files.rb
|
10
|
+
- ./lib/gl_rubocop/gl_cops/rails_cache.rb
|
10
11
|
- ./lib/gl_rubocop/gl_cops/sidekiq_inherits_from_sidekiq_job.rb
|
11
12
|
- ./lib/gl_rubocop/gl_cops/unique_identifier.rb
|
12
13
|
|
@@ -37,6 +38,9 @@ GLCops/CallbackMethodNames:
|
|
37
38
|
GLCops/PreventErbFiles:
|
38
39
|
Enabled: true
|
39
40
|
|
41
|
+
GLCops/RailsCache:
|
42
|
+
Enabled: true
|
43
|
+
|
40
44
|
GLCops/SidekiqInheritsFromSidekiqJob:
|
41
45
|
Include:
|
42
46
|
- 'app/**/*_worker.rb'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module GLRubocop
|
2
|
+
module GLCops
|
3
|
+
class RailsCache < RuboCop::Cop::Base
|
4
|
+
# This cop ensures that Rails.cache is not directly used.
|
5
|
+
# This is to prevent generation of unique key ids (SIG Code Quality Discussion 2024-12-16):
|
6
|
+
# https://www.notion.so/givelively/2024-12-16-152eb3d1736e805abe85de1fd96f3599?pvs=4#15eeb3d1736e80ecb82defd5d6b1f0e5
|
7
|
+
|
8
|
+
MSG = 'Rails.cache should not be used directly'.freeze
|
9
|
+
|
10
|
+
def_node_matcher :using_rails_cache?, <<~PATTERN
|
11
|
+
(send#{' '}
|
12
|
+
(send (const nil? :Rails) :cache)
|
13
|
+
{:fetch :read :write :delete :exist? :clear}
|
14
|
+
...)
|
15
|
+
PATTERN
|
16
|
+
|
17
|
+
def on_send(node)
|
18
|
+
return unless using_rails_cache?(node)
|
19
|
+
|
20
|
+
add_offense(node)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/gl_rubocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gl_rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Give Lively
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/gl_rubocop/gl_cops/callback_method_names.rb
|
124
124
|
- lib/gl_rubocop/gl_cops/interactor_inherits_from_interactor_base.rb
|
125
125
|
- lib/gl_rubocop/gl_cops/prevent_erb_files.rb
|
126
|
+
- lib/gl_rubocop/gl_cops/rails_cache.rb
|
126
127
|
- lib/gl_rubocop/gl_cops/sidekiq_inherits_from_sidekiq_job.rb
|
127
128
|
- lib/gl_rubocop/gl_cops/unique_identifier.rb
|
128
129
|
- lib/gl_rubocop/version.rb
|