ducalis 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -3
- data/.travis.yml +1 -1
- data/Gemfile.lock +5 -7
- data/Rakefile +2 -2
- data/bin/ducalis +1 -1
- data/ducalis.gemspec +1 -1
- data/lib/ducalis/cops/callbacks_activerecord.rb +2 -2
- data/lib/ducalis/cops/controllers_except.rb +2 -2
- data/lib/ducalis/cops/private_instance_assign.rb +1 -1
- data/lib/ducalis/cops/rest_only_cop.rb +1 -1
- data/lib/ducalis/cops/strings_in_activerecords.rb +3 -3
- data/lib/ducalis/cops/useless_only.rb +2 -2
- data/lib/ducalis/documentation.rb +1 -0
- data/lib/ducalis/version.rb +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42a073dbbd32041b55d28da53f799726b9f2ce28
|
4
|
+
data.tar.gz: ebc20a2e3383aa7838a193b247bbfbe40abae580
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ad451e36f98fc805296f6f5b3792a5cd2a46002bfb1be7031dab51079885809572eb6873ac931cf7f19079ad60486716e923df42f525928142bb22a8500d02
|
7
|
+
data.tar.gz: 466f33f3f4e8ab9c3af682fbd452c3e0d203d2c1c03c7fe3cba77d4055acc09004207ec2ab5b2b85b7a95f872de1d75bfef5b3541e8b8adecc55159f16b4859e
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ducalis (0.
|
4
|
+
ducalis (0.5.0)
|
5
5
|
git (~> 1.3, >= 1.3.0)
|
6
6
|
policial (= 0.0.4)
|
7
7
|
regexp-examples (~> 1.3, >= 1.3.2)
|
8
|
-
rubocop (
|
8
|
+
rubocop (~> 0.46.0, >= 0.45.0)
|
9
9
|
thor (~> 0.20.0)
|
10
10
|
|
11
11
|
GEM
|
@@ -38,7 +38,6 @@ GEM
|
|
38
38
|
multipart-post (2.0.0)
|
39
39
|
octokit (4.7.0)
|
40
40
|
sawyer (~> 0.8.0, >= 0.5.3)
|
41
|
-
parallel (1.12.0)
|
42
41
|
parser (2.4.0.0)
|
43
42
|
ast (~> 2.2)
|
44
43
|
policial (0.0.4)
|
@@ -68,11 +67,10 @@ GEM
|
|
68
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
69
68
|
rspec-support (~> 3.7.0)
|
70
69
|
rspec-support (3.7.0)
|
71
|
-
rubocop (0.
|
72
|
-
|
73
|
-
parser (>= 2.3.3.1, < 3.0)
|
70
|
+
rubocop (0.46.0)
|
71
|
+
parser (>= 2.3.1.1, < 3.0)
|
74
72
|
powerpack (~> 0.1)
|
75
|
-
rainbow (>=
|
73
|
+
rainbow (>= 1.99.1, < 3.0)
|
76
74
|
ruby-progressbar (~> 1.7)
|
77
75
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
78
76
|
ruby-progressbar (1.9.0)
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rspec/core/rake_task'
|
|
5
5
|
require 'rubocop/rake_task'
|
6
6
|
|
7
7
|
RuboCop::RakeTask.new do |task|
|
8
|
-
task.options = %w
|
8
|
+
task.options = %w(--auto-correct)
|
9
9
|
end
|
10
10
|
|
11
11
|
task :documentation do
|
@@ -14,4 +14,4 @@ task :documentation do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
RSpec::Core::RakeTask.new(:spec)
|
17
|
-
task default: %i
|
17
|
+
task default: %i(rubocop spec)
|
data/bin/ducalis
CHANGED
data/ducalis.gemspec
CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency 'git', '~> 1.3', '>= 1.3.0'
|
32
32
|
spec.add_dependency 'policial', '0.0.4'
|
33
33
|
spec.add_dependency 'regexp-examples', '~> 1.3', '>= 1.3.2'
|
34
|
-
spec.add_dependency 'rubocop', '
|
34
|
+
spec.add_dependency 'rubocop', '>= 0.45.0', '~> 0.46.0'
|
35
35
|
spec.add_dependency 'thor', '~> 0.20.0'
|
36
36
|
end
|
@@ -9,7 +9,7 @@ module Ducalis
|
|
9
9
|
'/services: to construct new objects. You can read more [here]'\
|
10
10
|
'(https://medium.com/planet-arkency/a61fd75ab2d3).'
|
11
11
|
MODELS_CLASS_NAMES = ['ApplicationRecord', 'ActiveRecord::Base'].freeze
|
12
|
-
METHODS_BLACK_LIST = %i
|
12
|
+
METHODS_BLACK_LIST = %i(
|
13
13
|
after_commit
|
14
14
|
after_create
|
15
15
|
after_destroy
|
@@ -26,7 +26,7 @@ module Ducalis
|
|
26
26
|
before_save
|
27
27
|
before_update
|
28
28
|
before_validation
|
29
|
-
|
29
|
+
).freeze
|
30
30
|
|
31
31
|
def on_class(node)
|
32
32
|
_classdef_node, superclass, _body = *node
|
@@ -5,8 +5,8 @@ require 'rubocop'
|
|
5
5
|
module Ducalis
|
6
6
|
class ControllersExcept < ::RuboCop::Cop::Cop
|
7
7
|
include RuboCop::Cop::DefNode
|
8
|
-
FILTERS = %i
|
9
|
-
before_action after_action around_action
|
8
|
+
FILTERS = %i(before_filter after_filter around_filter
|
9
|
+
before_action after_action around_action).freeze
|
10
10
|
OFFENSE = %(
|
11
11
|
Prefer to use `:only` over `:except` in controllers because it's more explicit \
|
12
12
|
and will be easier to maintain for new developers.
|
@@ -5,7 +5,7 @@ require 'rubocop'
|
|
5
5
|
module Ducalis
|
6
6
|
class RestOnlyCop < RuboCop::Cop::Cop
|
7
7
|
include RuboCop::Cop::DefNode
|
8
|
-
WHITELIST = %i
|
8
|
+
WHITELIST = %i(index show new edit create update destroy).freeze
|
9
9
|
OFFENSE = %(
|
10
10
|
It's better for controllers to stay adherent to REST:
|
11
11
|
http://jeromedalbert.com/how-dhh-organizes-his-rails-controllers/
|
@@ -11,10 +11,10 @@ It's hard to test, grep sources, code highlighting and so on.
|
|
11
11
|
Consider using of symbols or lambdas for complex expressions.
|
12
12
|
).strip
|
13
13
|
VALIDATEBLE_METHODS =
|
14
|
-
::Ducalis::CallbacksActiverecord::METHODS_BLACK_LIST + %i
|
14
|
+
::Ducalis::CallbacksActiverecord::METHODS_BLACK_LIST + %i(
|
15
15
|
validates
|
16
16
|
validate
|
17
|
-
|
17
|
+
)
|
18
18
|
|
19
19
|
def on_send(node)
|
20
20
|
_, method_name, *args = *node
|
@@ -31,7 +31,7 @@ Consider using of symbols or lambdas for complex expressions.
|
|
31
31
|
def skip_node?(current_node)
|
32
32
|
key, value = *current_node
|
33
33
|
return true unless current_node.type == :pair
|
34
|
-
return true unless %w
|
34
|
+
return true unless %w(if unless).include?(key.source)
|
35
35
|
return true unless value.type == :str
|
36
36
|
false
|
37
37
|
end
|
@@ -5,8 +5,8 @@ require 'rubocop'
|
|
5
5
|
module Ducalis
|
6
6
|
class UselessOnly < RuboCop::Cop::Cop
|
7
7
|
include RuboCop::Cop::DefNode
|
8
|
-
FILTERS = %i
|
9
|
-
before_action after_action around_action
|
8
|
+
FILTERS = %i(before_filter after_filter around_filter
|
9
|
+
before_action after_action around_action).freeze
|
10
10
|
OFFENSE = %(
|
11
11
|
Seems like there is no any reason to keep before filter only for one action. \
|
12
12
|
Maybe it will be better to inline it?
|
data/lib/ducalis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ducalis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignat Zakrevsky
|
@@ -68,16 +68,22 @@ dependencies:
|
|
68
68
|
name: rubocop
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 0.45.0
|
74
|
+
- - "~>"
|
72
75
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
76
|
+
version: 0.46.0
|
74
77
|
type: :runtime
|
75
78
|
prerelease: false
|
76
79
|
version_requirements: !ruby/object:Gem::Requirement
|
77
80
|
requirements:
|
78
|
-
- -
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.45.0
|
84
|
+
- - "~>"
|
79
85
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
86
|
+
version: 0.46.0
|
81
87
|
- !ruby/object:Gem::Dependency
|
82
88
|
name: thor
|
83
89
|
requirement: !ruby/object:Gem::Requirement
|