rubocop-mable 0.1.5 → 0.1.8
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/Gemfile.lock +18 -16
- data/README.md +9 -0
- data/config/default.yml +6 -0
- data/lib/rubocop/cop/mable/no_post_in_graph_ql.rb +4 -0
- data/lib/rubocop/cop/mable/using_deprecated_ff_client.rb +38 -0
- data/lib/rubocop/cop/mable_cops.rb +1 -0
- data/lib/rubocop/mable/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: 1bca068bb2c89a375fbda2d37300873f3898e3a0028a84549c17c69e61494f63
|
4
|
+
data.tar.gz: 98f533099ff194d28041160f5cd8a62dba9672f849740509f9d8a18b180def76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68f10a6d3425f42cd7eb4953f17fffcafcaf9b421a62d9fd0197ca61c3bfca4bb38184dfa582582277c7236d2340f46efb68d6efe4264c184bf63be2c9e10c8a
|
7
|
+
data.tar.gz: ce9903db8493da5a29030517c4f0a4a76e1c9491e80e9957f6659ee7fea6dc02f1d65e999b4acaaa401c57ed43c4fc3b41aabe1fbc248056cc3640e34a4b18d6
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-mable (0.1.
|
4
|
+
rubocop-mable (0.1.8)
|
5
5
|
rubocop
|
6
6
|
|
7
7
|
GEM
|
@@ -10,18 +10,20 @@ GEM
|
|
10
10
|
ast (2.4.2)
|
11
11
|
coderay (1.1.3)
|
12
12
|
diff-lcs (1.5.0)
|
13
|
-
json (2.
|
13
|
+
json (2.7.2)
|
14
|
+
language_server-protocol (3.17.0.3)
|
14
15
|
method_source (1.0.0)
|
15
|
-
parallel (1.
|
16
|
-
parser (3.
|
16
|
+
parallel (1.26.3)
|
17
|
+
parser (3.3.5.0)
|
17
18
|
ast (~> 2.4.1)
|
19
|
+
racc
|
18
20
|
pry (0.14.1)
|
19
21
|
coderay (~> 1.1)
|
20
22
|
method_source (~> 1.0)
|
23
|
+
racc (1.8.1)
|
21
24
|
rainbow (3.1.1)
|
22
25
|
rake (13.0.6)
|
23
|
-
regexp_parser (2.
|
24
|
-
rexml (3.2.5)
|
26
|
+
regexp_parser (2.9.2)
|
25
27
|
rspec (3.11.0)
|
26
28
|
rspec-core (~> 3.11.0)
|
27
29
|
rspec-expectations (~> 3.11.0)
|
@@ -35,24 +37,24 @@ GEM
|
|
35
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
38
|
rspec-support (~> 3.11.0)
|
37
39
|
rspec-support (3.11.0)
|
38
|
-
rubocop (1.
|
40
|
+
rubocop (1.67.0)
|
39
41
|
json (~> 2.3)
|
42
|
+
language_server-protocol (>= 3.17.0)
|
40
43
|
parallel (~> 1.10)
|
41
|
-
parser (>= 3.
|
44
|
+
parser (>= 3.3.0.2)
|
42
45
|
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>=
|
44
|
-
|
45
|
-
rubocop-ast (>= 1.18.0, < 2.0)
|
46
|
+
regexp_parser (>= 2.4, < 3.0)
|
47
|
+
rubocop-ast (>= 1.32.2, < 2.0)
|
46
48
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>=
|
48
|
-
rubocop-ast (1.
|
49
|
-
parser (>= 3.
|
49
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
50
|
+
rubocop-ast (1.32.3)
|
51
|
+
parser (>= 3.3.1.0)
|
50
52
|
rubocop-rake (0.6.0)
|
51
53
|
rubocop (~> 1.0)
|
52
54
|
rubocop-rspec (2.12.1)
|
53
55
|
rubocop (~> 1.31)
|
54
|
-
ruby-progressbar (1.
|
55
|
-
unicode-display_width (2.
|
56
|
+
ruby-progressbar (1.13.0)
|
57
|
+
unicode-display_width (2.6.0)
|
56
58
|
|
57
59
|
PLATFORMS
|
58
60
|
arm64-darwin-21
|
data/README.md
CHANGED
@@ -37,8 +37,17 @@ Enabled: true
|
|
37
37
|
Description: 'Avoid hardcoding factory bot database IDs, instead, dynamically test for the ID'
|
38
38
|
VersionAdded: '0.1.1'
|
39
39
|
|
40
|
+
Mable/UsingDeprecatedFFClient:
|
41
|
+
Description: "Using deprecated FeatureFlags::Client use FeatureFlags::Repo instead"
|
42
|
+
Enabled: true
|
43
|
+
SafeAutoCorrect: true
|
44
|
+
VersionAdded: "0.1.8"
|
40
45
|
```
|
41
46
|
|
47
|
+
## TODO
|
48
|
+
|
49
|
+
- No interpolating SQL use santitize instead
|
50
|
+
|
42
51
|
## Installation
|
43
52
|
|
44
53
|
Install the gem and add to the application's Gemfile by executing:
|
data/config/default.yml
CHANGED
@@ -28,3 +28,9 @@ Mable/NoWardenInGraphQL:
|
|
28
28
|
Enabled: true
|
29
29
|
SafeAutoCorrect: false
|
30
30
|
VersionAdded: "0.1.5"
|
31
|
+
|
32
|
+
Mable/UsingDeprecatedFFClient:
|
33
|
+
Description: "Using deprecated FeatureFlags::Client use FeatureFlags::Repo instead"
|
34
|
+
Enabled: true
|
35
|
+
SafeAutoCorrect: true
|
36
|
+
VersionAdded: "0.1.8"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Mable
|
6
|
+
# We are in the process of transitioning out the old FeatureFlags::Client and
|
7
|
+
# want people to be using FeatureFlags::Repo
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
#
|
11
|
+
# # bad
|
12
|
+
# FeatureFlags::Client.get_feature_flag("test", uuid: user.id)
|
13
|
+
#
|
14
|
+
# # good
|
15
|
+
# FeatureFlags::Repo.get_feature_flag("test", uuid: user.id)
|
16
|
+
#
|
17
|
+
class UsingDeprecatedFFClient < Base
|
18
|
+
extend AutoCorrector
|
19
|
+
|
20
|
+
MSG = 'FeatureFlags::Client is deprecated, please use FeatureFlags::Repo'
|
21
|
+
|
22
|
+
def_node_matcher :deprecated_ff_client?, <<~PATTERN
|
23
|
+
`(const (const nil? :FeatureFlags) :Client)
|
24
|
+
PATTERN
|
25
|
+
|
26
|
+
def on_send(node)
|
27
|
+
expression = deprecated_ff_client?(node)
|
28
|
+
return unless expression
|
29
|
+
|
30
|
+
add_offense(node) do |corrector|
|
31
|
+
replacement = node.source.sub('FeatureFlags::Client', 'FeatureFlags::Repo')
|
32
|
+
corrector.replace(node, replacement)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-mable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mable Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/rubocop/cop/mable/no_post_in_graph_ql.rb
|
63
63
|
- lib/rubocop/cop/mable/no_safety_assured.rb
|
64
64
|
- lib/rubocop/cop/mable/no_warden_in_graph_ql.rb
|
65
|
+
- lib/rubocop/cop/mable/using_deprecated_ff_client.rb
|
65
66
|
- lib/rubocop/cop/mable_cops.rb
|
66
67
|
- lib/rubocop/mable.rb
|
67
68
|
- lib/rubocop/mable/inject.rb
|