ducalis 0.5.3 → 0.5.4
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/DOCUMENTATION.md +9 -0
- data/Gemfile.lock +1 -1
- data/lib/ducalis/adapters/circle_ci.rb +1 -1
- data/lib/ducalis/cops/preferable_methods.rb +25 -0
- data/lib/ducalis/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 328e7b375b3c04b775fa5857eccbc0ea72fde606
|
4
|
+
data.tar.gz: 9e36648c4778ba101e3af5811a8356359383b7a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89622fd354b5feabd9390c12107a5e651e4dfbd1a3659efdebd578a930b33ebf4a40313723d00fde39b9558954f440413365701e59d891f2502b6bf0ddd10041
|
7
|
+
data.tar.gz: 1387adbbc6154a6b2eca280a3cea8d030b0f90fbf3a6bcc53e0604227df29d08607ba8b167d420f78099028d3ed1c2d6c8e130161464da237cfa9ff965fce4e0
|
data/DOCUMENTATION.md
CHANGED
@@ -450,6 +450,15 @@ def employee
|
|
450
450
|
@employee
|
451
451
|
end
|
452
452
|
|
453
|
+
```
|
454
|
+
## Ducalis::PreferableMethods
|
455
|
+
|
456
|
+
Prefer to use %<alternative>s method instead of %<original>s because of
|
457
|
+
%<reason>s.
|
458
|
+
|
459
|
+
 raises for `delete` method calling
|
460
|
+
```ruby
|
461
|
+
User.where(id: 7).delete
|
453
462
|
```
|
454
463
|
## Ducalis::PrivateInstanceAssign
|
455
464
|
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'rubocop'
|
3
|
+
|
4
|
+
module Ducalis
|
5
|
+
class PreferableMethods < RuboCop::Cop::Cop
|
6
|
+
OFFENSE = %(
|
7
|
+
Prefer to use %<alternative>s method instead of %<original>s because of
|
8
|
+
%<reason>s.
|
9
|
+
).strip
|
10
|
+
DESCRIPTION = {
|
11
|
+
# Method => [Alternative, Reason]
|
12
|
+
delete_all: [:destroy_all, 'it is not invoking callbacks'],
|
13
|
+
delete: [:destroy, 'it is not invoking callbacks']
|
14
|
+
}.freeze
|
15
|
+
|
16
|
+
def on_send(node)
|
17
|
+
_who, what, *_args = *node
|
18
|
+
return unless DESCRIPTION.keys.include?(what)
|
19
|
+
alternative, reason = DESCRIPTION.fetch(what)
|
20
|
+
add_offense(node, :expression, format(OFFENSE, original: what,
|
21
|
+
alternative: alternative,
|
22
|
+
reason: reason))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/ducalis/version.rb
CHANGED
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.4
|
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
|
+
date: 2017-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/ducalis/cops/module_like_class.rb
|
138
138
|
- lib/ducalis/cops/params_passing.rb
|
139
139
|
- lib/ducalis/cops/possible_tap.rb
|
140
|
+
- lib/ducalis/cops/preferable_methods.rb
|
140
141
|
- lib/ducalis/cops/private_instance_assign.rb
|
141
142
|
- lib/ducalis/cops/protected_scope_cop.rb
|
142
143
|
- lib/ducalis/cops/raise_withour_error_class.rb
|