rubocop-elegant 0.0.12 → 0.0.14

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: 339ef33644424e7d5a16d648c25e1816c25567ce88f65a68183ef0e6f293b335
4
- data.tar.gz: dbc16893f109848be8aab8c4757115c4fefe72d8b8d486547c13046fe1dd915a
3
+ metadata.gz: 3620bcb1fd58f208aefb372f08005c7551bbbd51c957c335105a293c56ff83b0
4
+ data.tar.gz: b02183fb7f7d13d097ed472f19a55918a0a9d5dc3a8e2b713d0334323b3d9088
5
5
  SHA512:
6
- metadata.gz: 9b1cdcc2a1cb3cd39a8436b8601082922587d1f8730a1f3138eff4ba6cd178114904acfd5acb6637b795f17986b5b6ac3bb4648af97e87efc39c7e3e2109ddfb
7
- data.tar.gz: 74e0563ef2342162ba2d80d0fc086c605c41793d6d7568c34d5a67362944297ec0ec43bdf52bc7dd319bbdf92a10b6f39c20f176339555dbddfae01b551cd7ee
6
+ metadata.gz: a3cd063438b9f2c581a9a6acae90f7ae3f9b7b2017cd9c4e7b280e11bf1377ae9bb141701bc410fa1bfb793d8b4636de0da598379355558cf49d299184491f66
7
+ data.tar.gz: 66bebaa301d79ef897a8c54b76d60ea7a5c937b68789d7ce00ffb652515c7b7e4d1b0cf36712b8a869d70c01ae5337e3b9b04357035c624681b94f52a2a25de4
data/config/default.yml CHANGED
@@ -16,12 +16,12 @@ Elegant/GoodVariableName:
16
16
  Description: 'Checks that variable names match the configured pattern'
17
17
  Enabled: true
18
18
  VersionAdded: '0.0.3'
19
- Pattern: '^(@{1,2}|\$)?(the_|test_|fake_)?[a-z]{1,16}$'
19
+ Pattern: '^(_.*|(@{1,2}|\$)?(the_|test_|fake_)?[a-z]{1,16})$'
20
20
  Elegant/GoodMethodName:
21
21
  Description: 'Checks that method names match the configured pattern'
22
22
  Enabled: true
23
23
  VersionAdded: '0.0.3'
24
- Pattern: '^((fake_|the_)?[a-z]{1,16}[!?]?|test_[a-z_]+|on_[a-z_]+)$'
24
+ Pattern: '^(((to|fake|the|with|without|on)_)?[a-z]{1,16}[!?]?|test_[a-z_]+)$'
25
25
 
26
26
  Naming/VariableName:
27
27
  Enabled: false
@@ -9,14 +9,16 @@ module RuboCop
9
9
  class NoComments < Base
10
10
  extend AutoCorrector
11
11
 
12
- MSG = 'Comment is not allowed, unless it is SPDX, magic, or rubocop directive'
12
+ MSG = 'Comment is not allowed, unless it is SPDX, magic, rubocop directive, or docblock'
13
13
  public_constant :MSG
14
14
 
15
+ # rubocop:disable Elegant/GoodMethodName
15
16
  def on_new_investigation
16
17
  processed_source.comments.each do |comment|
17
18
  register(comment) unless allowed?(comment)
18
19
  end
19
20
  end
21
+ # rubocop:enable Elegant/GoodMethodName
20
22
 
21
23
  private
22
24
 
@@ -40,8 +42,14 @@ module RuboCop
40
42
  return @gemspec if defined?(@gemspec)
41
43
  path = processed_source.path
42
44
  return @gemspec = false if path.nil?
43
- dir = File.dirname(path)
44
- @gemspec = Dir.glob(File.join(dir, '*.gemspec')).any?
45
+ @gemspec = root(File.dirname(path))
46
+ end
47
+
48
+ def root(dir)
49
+ return true if Dir.glob(File.join(dir, '*.gemspec')).any?
50
+ parent = File.dirname(dir)
51
+ return false if parent == dir
52
+ root(parent)
45
53
  end
46
54
 
47
55
  def docblock?(comment)
@@ -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'
12
+ s.version = '0.0.14'
13
13
  s.license = 'MIT'
14
14
  s.summary = 'Set of custom RuboCop cops for elegant Ruby coding'
15
15
  s.description =
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-elegant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko