rubocop-mable 0.1.2.4 → 0.1.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/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/mable/no_safety_assured.rb +37 -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: 402b8f356986fdfa523dcecccf1b2fb74f4a9c6ce34c191db74d1b839f00058b
|
4
|
+
data.tar.gz: 1e671dd68702a88b13eb3b0fe39954a710f5422e3c13d3c331424f2ab5fa9b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c261761ae3726394462842ff37774f47984567e66c3152e7a86a6d960b15c15251a660c5f53e949bb2b4669e76aa1344b4d3eaea82c410d9cc19bbd83a088a19
|
7
|
+
data.tar.gz: 6d07e483bc9da12e4d7875d12673cbf05401ffaaadb76db3cb42d226d467e7f19bf04bd39d77a19e2a206b8733649dedbbd9e77804691db12c6660ad7ec9ed50
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,11 @@ Mable's custom Rubocop cops
|
|
5
5
|
## Cops
|
6
6
|
|
7
7
|
```
|
8
|
+
Mable/NoSafetyAssured:
|
9
|
+
Description: 'An extra check to ensure that the safety_assured is required'
|
10
|
+
Enabled: true
|
11
|
+
VersionAdded: '0.1.3'
|
12
|
+
|
8
13
|
Mable/GraphQLHelperSpecs:
|
9
14
|
Description: 'Avoid hardcoding GraphQl path use helper instead.'
|
10
15
|
Enabled: true
|
data/config/default.yml
CHANGED
@@ -7,3 +7,8 @@ Mable/HardcodedDatabaseFactoryBotId:
|
|
7
7
|
Enabled: true
|
8
8
|
Description: 'Avoid hardcoding factory bot database IDs, instead, dynamically test for the ID'
|
9
9
|
VersionAdded: '0.1.1'
|
10
|
+
|
11
|
+
Mable/NoSafetyAssured:
|
12
|
+
Description: 'An extra check to ensure that the safety_assured is required'
|
13
|
+
Enabled: true
|
14
|
+
VersionAdded: '0.1.3'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Mable
|
6
|
+
# An extra check to ensure that the safety_assured is required
|
7
|
+
# https://github.com/ankane/strong_migrations
|
8
|
+
|
9
|
+
# @safety
|
10
|
+
# Can't be autocorrected because it's a manual check
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # bad
|
14
|
+
# safety_assured { remove_column :model_name....
|
15
|
+
|
16
|
+
# # good
|
17
|
+
# remove_column :model_name....
|
18
|
+
|
19
|
+
class NoSafetyAssured < Base
|
20
|
+
MSG = 'Are you sure safety_assured is required, is there a better way? https://github.com/ankane/strong_migrations'
|
21
|
+
|
22
|
+
RESTRICT_ON_SEND = %i[safety_assured].freeze
|
23
|
+
|
24
|
+
# @!method bad_method?(node)
|
25
|
+
def_node_matcher :safety_assured?, <<~PATTERN
|
26
|
+
(send nil? :safety_assured ...)
|
27
|
+
PATTERN
|
28
|
+
|
29
|
+
def on_send(node)
|
30
|
+
return unless safety_assured?(node)
|
31
|
+
|
32
|
+
add_offense(node)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mable Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/rubocop-mable.rb
|
60
60
|
- lib/rubocop/cop/mable/graph_ql_helper_specs.rb
|
61
61
|
- lib/rubocop/cop/mable/hardcoded_database_factory_bot_id.rb
|
62
|
+
- lib/rubocop/cop/mable/no_safety_assured.rb
|
62
63
|
- lib/rubocop/cop/mable_cops.rb
|
63
64
|
- lib/rubocop/mable.rb
|
64
65
|
- lib/rubocop/mable/inject.rb
|