ducalis 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/DOCUMENTATION.md +1 -42
- data/Gemfile.lock +1 -1
- data/config/.ducalis.yml +1 -1
- data/lib/ducalis/cops/{raise_withour_error_class.rb → raise_without_error_class.rb} +2 -2
- data/lib/ducalis/documentation.rb +7 -1
- data/lib/ducalis/version.rb +1 -1
- data/lib/ducalis.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21e653839c1ac51f59d14a84abede1d7f3fc8d95
|
4
|
+
data.tar.gz: 89f274016015741d35d85b1c664191b41ec05948
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2ac4461691ba39f23a0e1f5fa7bef701daf5b50cad2c31bec1ced0556899f27923efc0490d37bbcffa00fec3c594015497e6c406d325dc5d40e40d7ff9e2a92
|
7
|
+
data.tar.gz: 78e397569b05a3859b4ef295298f03cf17ea91746a1791d86f01688712cb9ad0619c46259f2f171cf71a58967275886e9075acc6751a002d8e11af8b0878bc65
|
data/.travis.yml
CHANGED
data/DOCUMENTATION.md
CHANGED
@@ -489,47 +489,6 @@ def stop_terminated_employee
|
|
489
489
|
end
|
490
490
|
|
491
491
|
|
492
|
-
```
|
493
|
-
|
494
|
-
![](https://placehold.it/10/2cbe4e/000000?text=+) [bugfix] calling methods on possible tap variable
|
495
|
-
```ruby
|
496
|
-
|
497
|
-
def create_message_struct(message)
|
498
|
-
objects = message.map { |object| process(object) }
|
499
|
-
Auditor::Message.new(message.process, objects)
|
500
|
-
end
|
501
|
-
|
502
|
-
```
|
503
|
-
|
504
|
-
![](https://placehold.it/10/2cbe4e/000000?text=+) [bugfix] methods which simply returns instance var without changes
|
505
|
-
```ruby
|
506
|
-
|
507
|
-
def employee
|
508
|
-
@employee
|
509
|
-
end
|
510
|
-
|
511
|
-
```
|
512
|
-
|
513
|
-
![](https://placehold.it/10/2cbe4e/000000?text=+) [bugfix] methods which ends with if condition
|
514
|
-
```ruby
|
515
|
-
|
516
|
-
def complete=(value, complete_at)
|
517
|
-
value = value.to_b
|
518
|
-
self.complete_at = complete_at if complete && value
|
519
|
-
self.complete_at = nil unless value
|
520
|
-
end
|
521
|
-
|
522
|
-
```
|
523
|
-
|
524
|
-
![](https://placehold.it/10/2cbe4e/000000?text=+) [bugfix] methods with args without children nodes
|
525
|
-
```ruby
|
526
|
-
|
527
|
-
def filtered_admins(reducers)
|
528
|
-
reducers
|
529
|
-
.map { |reducer| @base_scope.public_send(reducer) }
|
530
|
-
.order("admin_users.created_at DESC")
|
531
|
-
end
|
532
|
-
|
533
492
|
```
|
534
493
|
## Ducalis::PreferableMethods
|
535
494
|
|
@@ -667,7 +626,7 @@ MAPPING.find do |x|
|
|
667
626
|
end
|
668
627
|
|
669
628
|
```
|
670
|
-
## Ducalis::
|
629
|
+
## Ducalis::RaiseWithoutErrorClass
|
671
630
|
|
672
631
|
It's better to add exception class as raise argument. It will make
|
673
632
|
easier to catch and process it later.
|
data/Gemfile.lock
CHANGED
data/config/.ducalis.yml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'rubocop'
|
4
4
|
|
5
5
|
module Ducalis
|
6
|
-
class
|
6
|
+
class RaiseWithoutErrorClass < RuboCop::Cop::Cop
|
7
7
|
OFFENSE = <<-MESSAGE.gsub(/^ +\|/, '').strip
|
8
8
|
| It's better to add exception class as raise argument. It will make
|
9
9
|
| easier to catch and process it later.
|
@@ -12,7 +12,7 @@ module Ducalis
|
|
12
12
|
def on_send(node)
|
13
13
|
_who, what, *args = *node
|
14
14
|
return if what != :raise
|
15
|
-
return if args.first.type != :str
|
15
|
+
return if args.first && args.first.type != :str
|
16
16
|
add_offense(node, :expression, OFFENSE)
|
17
17
|
end
|
18
18
|
end
|
@@ -60,6 +60,7 @@ class Documentation
|
|
60
60
|
RED_SQUARE = '![](https://placehold.it/10/f03c15/000000?text=+)'
|
61
61
|
GREEN_SQUARE = '![](https://placehold.it/10/2cbe4e/000000?text=+)'
|
62
62
|
SIGNAL_WORD = 'raises'
|
63
|
+
IGNORE_WORDS = ['[bugfix]'].freeze
|
63
64
|
|
64
65
|
def call
|
65
66
|
Dir['./lib/ducalis/cops/*.rb'].sort.map do |f|
|
@@ -100,7 +101,12 @@ class Documentation
|
|
100
101
|
)
|
101
102
|
SpecsProcessor.new.tap do |processor|
|
102
103
|
processor.process(Parser::CurrentRuby.parse(source_code))
|
103
|
-
end.cases
|
104
|
+
end.cases.reject(&method(:ignored?))
|
105
|
+
end
|
106
|
+
|
107
|
+
def ignored?(example)
|
108
|
+
desc, _code = example
|
109
|
+
IGNORE_WORDS.any? { |word| desc.include?(word) }
|
104
110
|
end
|
105
111
|
|
106
112
|
def klass_const_for(f)
|
data/lib/ducalis/version.rb
CHANGED
data/lib/ducalis.rb
CHANGED
@@ -42,7 +42,7 @@ require 'ducalis/cops/possible_tap'
|
|
42
42
|
require 'ducalis/cops/private_instance_assign'
|
43
43
|
require 'ducalis/cops/preferable_methods'
|
44
44
|
require 'ducalis/cops/protected_scope_cop'
|
45
|
-
require 'ducalis/cops/
|
45
|
+
require 'ducalis/cops/raise_without_error_class'
|
46
46
|
require 'ducalis/cops/regex_cop'
|
47
47
|
require 'ducalis/cops/rest_only_cop'
|
48
48
|
require 'ducalis/cops/rubocop_disable'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ducalis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignat Zakrevsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -141,7 +141,7 @@ files:
|
|
141
141
|
- lib/ducalis/cops/preferable_methods.rb
|
142
142
|
- lib/ducalis/cops/private_instance_assign.rb
|
143
143
|
- lib/ducalis/cops/protected_scope_cop.rb
|
144
|
-
- lib/ducalis/cops/
|
144
|
+
- lib/ducalis/cops/raise_without_error_class.rb
|
145
145
|
- lib/ducalis/cops/regex_cop.rb
|
146
146
|
- lib/ducalis/cops/rest_only_cop.rb
|
147
147
|
- lib/ducalis/cops/rubocop_disable.rb
|