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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5d683e80171e6ec4ddb878fc71c230a22478b10bd934599a1dc82f4f4a7d3db
4
- data.tar.gz: 1176a6e964f99beaa4bf7678c26af5cf491ac7a2c1e04bb7336bae5931099de3
3
+ metadata.gz: 402b8f356986fdfa523dcecccf1b2fb74f4a9c6ce34c191db74d1b839f00058b
4
+ data.tar.gz: 1e671dd68702a88b13eb3b0fe39954a710f5422e3c13d3c331424f2ab5fa9b17
5
5
  SHA512:
6
- metadata.gz: c3b5cedd1881ca5ecd2d1a6733f88cef38446ccfb198bf0e5207b0419e22fcd88b71723ace06d2e727b65a20ea062882ce939b4337e272f61414949db5bee0b8
7
- data.tar.gz: 0ff53b079406c6d0010ad331331bf9687e38387a3a2d9d80f3b439331677b32b5e5499abf2470bd3e0a3e65ee4d338b7fbb546cb54b345baf67c172b0a21bfb0
6
+ metadata.gz: c261761ae3726394462842ff37774f47984567e66c3152e7a86a6d960b15c15251a660c5f53e949bb2b4669e76aa1344b4d3eaea82c410d9cc19bbd83a088a19
7
+ data.tar.gz: 6d07e483bc9da12e4d7875d12673cbf05401ffaaadb76db3cb42d226d467e7f19bf04bd39d77a19e2a206b8733649dedbbd9e77804691db12c6660ad7ec9ed50
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-mable (0.1.2.4)
4
+ rubocop-mable (0.1.3)
5
5
  rubocop
6
6
 
7
7
  GEM
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
@@ -2,3 +2,4 @@
2
2
 
3
3
  require_relative 'mable/graph_ql_helper_specs'
4
4
  require_relative 'mable/hardcoded_database_factory_bot_id'
5
+ require_relative 'mable/no_safety_assured'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Mable
5
- VERSION = '0.1.2.4'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  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.2.4
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-16 00:00:00.000000000 Z
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