rubocop-elegant 0.0.14 → 0.0.16
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08f7c72220dd8c4891df6a624b6512dc8d1ba168a06bc6da1604fb02bd36a8dd'
|
|
4
|
+
data.tar.gz: 4ff3c4eac54cceed9d637afdb4c97ca70cbef72eb28b8df872e553ba56f8790c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f8e30eb4fc5700751aee110ebc192714bd9e545eabbecc12c87be16741d8b3e19f8a353cd7d2a271d8e8c318bf7302d200e89f990c8986ca584c2ab267fc2693
|
|
7
|
+
data.tar.gz: 5b450b899700180092bd5d492dde402b8ba18aa0a542f4efbab7193180cb8cd2e842a92fd4adc7e68112c4dd266c43b51aff3f2016c14547c02a8a52c5be8dd2
|
data/config/default.yml
CHANGED
|
@@ -17,12 +17,16 @@ Elegant/GoodVariableName:
|
|
|
17
17
|
Enabled: true
|
|
18
18
|
VersionAdded: '0.0.3'
|
|
19
19
|
Pattern: '^(_.*|(@{1,2}|\$)?(the_|test_|fake_)?[a-z]{1,16})$'
|
|
20
|
+
AllowedNames: []
|
|
20
21
|
Elegant/GoodMethodName:
|
|
21
22
|
Description: 'Checks that method names match the configured pattern'
|
|
22
23
|
Enabled: true
|
|
23
24
|
VersionAdded: '0.0.3'
|
|
24
25
|
Pattern: '^(((to|fake|the|with|without|on)_)?[a-z]{1,16}[!?]?|test_[a-z_]+)$'
|
|
26
|
+
AllowedNames: []
|
|
25
27
|
|
|
28
|
+
Style/RedundantException:
|
|
29
|
+
Enabled: false
|
|
26
30
|
Naming/VariableName:
|
|
27
31
|
Enabled: false
|
|
28
32
|
Naming/MethodName:
|
|
@@ -21,6 +21,7 @@ module RuboCop
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
23
|
def check(node, name)
|
|
24
|
+
return if allowed?(name)
|
|
24
25
|
return if match?(name)
|
|
25
26
|
add_offense(node, message: format(MSG, name: name))
|
|
26
27
|
end
|
|
@@ -29,6 +30,10 @@ module RuboCop
|
|
|
29
30
|
pattern.match?(name)
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
def allowed?(name)
|
|
34
|
+
Array(cop_config['AllowedNames']).map(&:to_s).include?(name)
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
def pattern
|
|
33
38
|
@pattern ||= Regexp.new(cop_config['Pattern'] || '^[a-z]+[!?]?$')
|
|
34
39
|
end
|
|
@@ -29,6 +29,7 @@ module RuboCop
|
|
|
29
29
|
private
|
|
30
30
|
|
|
31
31
|
def check(node, name)
|
|
32
|
+
return if allowed?(name)
|
|
32
33
|
return if match?(name)
|
|
33
34
|
add_offense(node, message: format(MSG, name: name))
|
|
34
35
|
end
|
|
@@ -37,6 +38,10 @@ module RuboCop
|
|
|
37
38
|
pattern.match?(name)
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
def allowed?(name)
|
|
42
|
+
Array(cop_config['AllowedNames']).map(&:to_s).include?(name)
|
|
43
|
+
end
|
|
44
|
+
|
|
40
45
|
def pattern
|
|
41
46
|
@pattern ||= Regexp.new(cop_config['Pattern'] || '^[a-z]+$')
|
|
42
47
|
end
|
data/rubocop-elegant.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to?(:required_rubygems_version=)
|
|
10
10
|
s.required_ruby_version = '>=2.2'
|
|
11
11
|
s.name = 'rubocop-elegant'
|
|
12
|
-
s.version = '0.0.
|
|
12
|
+
s.version = '0.0.16'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Set of custom RuboCop cops for elegant Ruby coding'
|
|
15
15
|
s.description =
|