rubocop-vicenzo 0.1.0 → 0.1.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/config/default.yml +12 -8
- data/lib/rubocop/cop/vicenzo/rails/enum_inclusion_of_validation.rb +4 -3
- data/lib/rubocop/vicenzo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed82c28ffcefb60cfdace3b56e7076dccfdfc8bdd936250554ee3adb99c74903
|
4
|
+
data.tar.gz: fc149cec1118966ed088ddf9b0d6b9f2375c25d364396fb5d2069991337dc2ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79466db290631d6846ac960fcc8c30c7feb6b89e824443ada09c42f7b4d57a474268fe7c9fa37a686297bfcf538d715190da643dbeb53633c866e9dba3d3bf36
|
7
|
+
data.tar.gz: a0f924f733ba96918a8b5199f9a876c168184cc52cd476c3a3976929edc9cac2239ccf2fbc53e617c6cb340d60de4bf72a46a9d7072de675b461a83c1581b47e
|
data/CHANGELOG.md
CHANGED
data/config/default.yml
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
+
Vicenzo/Rails/EnumInclusionOfValidation:
|
2
|
+
Description: 'Check if the enum has the inclusion of validation defined.'
|
3
|
+
Enabled: true
|
4
|
+
Severity: convention
|
5
|
+
VersionAdded: '0.1.0'
|
6
|
+
|
1
7
|
Vicenzo/RSpec/MixedExampleGroups:
|
2
8
|
Description: 'Check if there are example and groups at same level'
|
3
|
-
Enabled:
|
9
|
+
Enabled: true
|
10
|
+
Severity: warning
|
4
11
|
VersionAdded: '0.1.0'
|
5
12
|
|
6
13
|
Vicenzo/RSpec/NestedContextImproperStart:
|
7
14
|
Description: 'Check if the nested context does not start as a root one.'
|
8
|
-
Enabled:
|
15
|
+
Enabled: true
|
16
|
+
Severity: convention
|
9
17
|
VersionAdded: '0.1.0'
|
10
18
|
|
11
19
|
Vicenzo/RSpec/NestedLetRedefinition:
|
@@ -16,10 +24,6 @@ Vicenzo/RSpec/NestedLetRedefinition:
|
|
16
24
|
|
17
25
|
Vicenzo/RSpec/NestedSubjectRedefinition:
|
18
26
|
Description: 'Check if a subject is redefined in a nested example group.'
|
19
|
-
Enabled:
|
20
|
-
|
21
|
-
|
22
|
-
Vicenzo/Rails/EnumInclusionOfValidation:
|
23
|
-
Description: 'Check if the enum has the inclusion of validation defined.'
|
24
|
-
Enabled: convention
|
27
|
+
Enabled: true
|
28
|
+
Severity: warning
|
25
29
|
VersionAdded: '0.1.0'
|
@@ -52,7 +52,7 @@ module RuboCop
|
|
52
52
|
private
|
53
53
|
|
54
54
|
def find_validate_option(enum_node)
|
55
|
-
enum_node
|
55
|
+
options_node_for(enum_node)&.each_pair&.find { |pair| pair.key.value == :validate }
|
56
56
|
end
|
57
57
|
|
58
58
|
def valid_validate_option?(validate_kwarg)
|
@@ -62,14 +62,15 @@ module RuboCop
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
65
|
+
def options_node_for(enum_node)
|
66
66
|
enum_node.last_argument if enum_node.last_argument.hash_type?
|
67
67
|
end
|
68
68
|
|
69
69
|
def register_offence_for(enum_node, validate_kwarg)
|
70
70
|
if validate_kwarg.nil?
|
71
71
|
add_offense(enum_node, message: MSG_MISSING_VALIDATE) do |corrector|
|
72
|
-
|
72
|
+
last_node = options_node_for(enum_node) || enum_node.last_argument
|
73
|
+
corrector.insert_after(last_node, ', validate: { allow_nil: true }')
|
73
74
|
end
|
74
75
|
elsif !valid_validate_option?(validate_kwarg)
|
75
76
|
add_offense(validate_kwarg, message: MSG_INVALID_VALIDATE) do |corrector|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-vicenzo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Vicenzo
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-08-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: lint_roller
|
@@ -51,7 +51,8 @@ dependencies:
|
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 3.5.0
|
54
|
-
description:
|
54
|
+
description: A growing set of custom RuboCop cops capturing the best practices I've
|
55
|
+
been learning.
|
55
56
|
email:
|
56
57
|
- bruno@alumni.usp.br
|
57
58
|
executables: []
|