rubocop-elegant 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07050b077e5266437a527369312875e178be1df47c24f2792fd5945060fe0e26
4
- data.tar.gz: 04ad13719f726d00a61a5cd287573813ce6d2780ef4ef7e8ea4092ed02a24af2
3
+ metadata.gz: 400170a3fda22ccd3c629d58a47a9c142da2ebd38bd34c292fc702fc47e3fc51
4
+ data.tar.gz: c82766e8b09239583a125b2d769e01a356330a83210e113dfdf43031a81a59ec
5
5
  SHA512:
6
- metadata.gz: 384fa71d95456e0515d5bb4a518a65af285f6e9774289163595e3f1a1885473dab1f85f931ce731e5376d6fa73029991f7cd5624771736e5650dec8e06b845ab
7
- data.tar.gz: d9d7248056d93b0c1c0d81afd0e7c96c709e314e944eeb95365ef1affe3d4f1342607f84b6da874a2e3a68ae3eb21fa0064e9163449935f1a695906f2da5fae4
6
+ metadata.gz: 1c2d09a8e4d0ffa82a2371396310bdd2d1cb0fa1308b87333f13edb30d9b3551a769309fe8e7a311806c221319c89b4be3160261115e92d9935ace180b878974
7
+ data.tar.gz: 7200ec078d268fe5baadd7ba8627f3b20c705273444cdd7ad81b73d63009ffa93f9ae91be1fc267ae46b17b551519c5c93d4adfbabbfa228e7a0b78945dfaa18
data/README.md CHANGED
@@ -26,7 +26,7 @@ The custom cops add the following restrictions:
26
26
  * Method names must be single lowercase verbs.
27
27
  * Variable names must be single lowercase nouns.
28
28
  * Each indentation step must add exactly two spaces.
29
- * Comments are forbidden, except SPDX, magic, RuboCop directives, and class docblocks.
29
+ * Comments are forbidden, except SPDX, magic, RuboCop, PDD puzzles, docblocks.
30
30
  * Empty lines inside block bodies are forbidden.
31
31
  * Empty lines inside method bodies are forbidden.
32
32
  * A method cannot return `nil` explicitly.
data/config/default.yml CHANGED
@@ -6,7 +6,7 @@ Elegant:
6
6
  Enabled: true
7
7
  DocumentationBaseURL: https://github.com/yegor256/rubocop-elegant
8
8
  Elegant/NoComments:
9
- Description: 'Disallows comments in source code, except SPDX license comments'
9
+ Description: 'Disallows comments in source code, except SPDX, magic, rubocop directives, PDD puzzles, and docblocks'
10
10
  Enabled: true
11
11
  VersionAdded: '0.0.1'
12
12
  Elegant/NoEmptyLinesInMethods:
@@ -6,7 +6,7 @@
6
6
  class RuboCop::Cop::Elegant::NoComments < RuboCop::Cop::Base
7
7
  extend RuboCop::Cop::AutoCorrector
8
8
 
9
- MSG = 'Comment is not allowed, unless it is SPDX, magic, rubocop directive, or docblock'
9
+ MSG = 'Comment is not allowed, unless it is SPDX, magic, rubocop directive, PDD puzzle, or docblock'
10
10
  public_constant :MSG
11
11
 
12
12
  def on_new_investigation
@@ -18,7 +18,11 @@ class RuboCop::Cop::Elegant::NoComments < RuboCop::Cop::Base
18
18
  private
19
19
 
20
20
  def allowed?(comment)
21
- spdx?(comment) || magic?(comment) || rubocop?(comment) || (gemspec? && docblock?(comment))
21
+ spdx?(comment) || magic?(comment) || rubocop?(comment) || puzzle?(comment) || (gemspec? && docblock?(comment))
22
+ end
23
+
24
+ def puzzle?(comment)
25
+ comment.text.match?(/@todo\b/i)
22
26
  end
23
27
 
24
28
  def spdx?(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.5.0'
12
+ s.version = '0.5.1'
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.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko