rf-stylez 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rf/stylez/version.rb +1 -1
- data/lib/rubocop/cop/lint/use_positive_int32_validator.rb +4 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 751b7ae7cc21d09573f52bce835548439f93d2fabbd8203f5c4c771a2de01751
|
4
|
+
data.tar.gz: e286ad8370c51bad6be5250a82ffc8a297ec13877a476452188beb0854653d51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de22f3351e96f398f715640bab0392e2f98685cee66edae64a6472a0709604bc83a01b760a3612705030195c47de9a171059744ab54fe1865836e00667543c19
|
7
|
+
data.tar.gz: 86a87e0d8dd195888b112cabbf52189d087d61c15fadf5e7c40f6045bc23e3d79ea589d3d87b79360beba65742fef8087ee82cac10b35494fd8e2528e2e401b3
|
data/lib/rf/stylez/version.rb
CHANGED
@@ -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`'
|
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) (
|
28
|
+
def_node_search :validates_integer?, '(pair (sym :positive_int32) {{true false} (int _)})'
|
31
29
|
|
32
30
|
def on_block(node)
|
33
|
-
|
34
|
-
|
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.
|
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-
|
11
|
+
date: 2020-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|