rf-stylez 0.5.0 → 0.5.1

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: 05a16ca2326a623f6caff7a3989ceca3d08ba53324de71c0c34fe780821aaebb
4
- data.tar.gz: 8139f2d31d10c1ad17fb616bd5a91b17dbeaf1d68fe24bf47590d7dc673fca34
3
+ metadata.gz: 751b7ae7cc21d09573f52bce835548439f93d2fabbd8203f5c4c771a2de01751
4
+ data.tar.gz: e286ad8370c51bad6be5250a82ffc8a297ec13877a476452188beb0854653d51
5
5
  SHA512:
6
- metadata.gz: f8a9ebb0ed26c14273c17368d7b2ad697ddf26159a15c743673bcaf3bdd0bbc72498eff11a72ea7a56534130084b630ace98bd647bd9555584093eadd3640a30
7
- data.tar.gz: 18ea1dc2f36c0357963809b5c2ad43d680af5d0bc963c263602b0a94b3fa56179fb7800c869e40413575736001fb7e80b0e014b9ced8adb09593b697becef9b6
6
+ metadata.gz: de22f3351e96f398f715640bab0392e2f98685cee66edae64a6472a0709604bc83a01b760a3612705030195c47de9a171059744ab54fe1865836e00667543c19
7
+ data.tar.gz: 86a87e0d8dd195888b112cabbf52189d087d61c15fadf5e7c40f6045bc23e3d79ea589d3d87b79360beba65742fef8087ee82cac10b35494fd8e2528e2e401b3
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rf
4
4
  module Stylez
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
@@ -14,10 +14,8 @@ module RuboCop
14
14
  # requires :id, type: Integer, positive_int32: true
15
15
  # end
16
16
  class UsePositiveInt32Validator < Cop
17
- MSG = 'If this Integer maps to a postgres Integer column, validate with `positive_int32: true`'.freeze
17
+ MSG = 'If this Integer maps to a postgres Integer column, validate with `positive_int32: true`'
18
18
 
19
- # if a params block, return all the nodes in it
20
- def_node_matcher :is_grape_params?, '(block (send nil? :params) (args) $...)'
21
19
  # check if the param is `requires` / `optional`
22
20
  def_node_search :find_params_hashes, <<~PATTERN
23
21
  (send nil? {:requires :optional}
@@ -27,13 +25,11 @@ module RuboCop
27
25
  # check if hash contains `type: Integer`
28
26
  def_node_search :is_type_integer?, '(pair (sym :type) (const nil? :Integer))'
29
27
  # check if the hash contains the `positive_int32` validator
30
- def_node_search :validates_integer?, '(pair (sym :positive_int32) (true))'
28
+ def_node_search :validates_integer?, '(pair (sym :positive_int32) {{true false} (int _)})'
31
29
 
32
30
  def on_block(node)
33
- params = is_grape_params?(node)
34
- return unless
35
- hash = find_params_hashes(node)
36
- hash&.each do |param|
31
+ return unless (hash = find_params_hashes(node))
32
+ hash.each do |param|
37
33
  if is_type_integer?(param) && !validates_integer?(param)
38
34
  add_offense(param)
39
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rf-stylez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emanuel Evans
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop