rubocop-elegant 0.0.12 → 0.0.13
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/lib/rubocop/cop/elegant/no_comments.rb +9 -3
- data/rubocop-elegant.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52b4a90ea309c9255ce91551140e414d270d93084d5db71ab0ca6c274b989064
|
|
4
|
+
data.tar.gz: 88cf9d0d858f6c551fa8b4adc9c9a319f8008496f97853f458c6c419c61d8b7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8578b0c3c3ec4dfda7a4bb23be3595cebffc8fc6a61189fe671d24f64ee520e3b12db3e76651d6885c6b8d29e18692f1f0cb806aac70cf1e3a4eb25cca57d303
|
|
7
|
+
data.tar.gz: 0b73760980abf0f65481797d62e82fa7e813dbc980cb9f14274ce2185132ea68dcbd116d0b0ceff8fb9ae4650f1724b76aab4534ffe8bc268111ab80845e7540
|
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
|
9
9
|
class NoComments < Base
|
|
10
10
|
extend AutoCorrector
|
|
11
11
|
|
|
12
|
-
MSG = 'Comment is not allowed, unless it is SPDX, magic,
|
|
12
|
+
MSG = 'Comment is not allowed, unless it is SPDX, magic, rubocop directive, or docblock'
|
|
13
13
|
public_constant :MSG
|
|
14
14
|
|
|
15
15
|
def on_new_investigation
|
|
@@ -40,8 +40,14 @@ module RuboCop
|
|
|
40
40
|
return @gemspec if defined?(@gemspec)
|
|
41
41
|
path = processed_source.path
|
|
42
42
|
return @gemspec = false if path.nil?
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
@gemspec = root(File.dirname(path))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def root(dir)
|
|
47
|
+
return true if Dir.glob(File.join(dir, '*.gemspec')).any?
|
|
48
|
+
parent = File.dirname(dir)
|
|
49
|
+
return false if parent == dir
|
|
50
|
+
root(parent)
|
|
45
51
|
end
|
|
46
52
|
|
|
47
53
|
def docblock?(comment)
|
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.13'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Set of custom RuboCop cops for elegant Ruby coding'
|
|
15
15
|
s.description =
|