rubocop-rails-order_model_declarative_methods 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a84c4a1c264ea7744047c1ea5040422d705e5824
|
4
|
+
data.tar.gz: 48b9b7cc6a7e4c5fbc5fda6764b28d43c3ac77cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b4d3005fee348ebc37345b7a3862d667e1f5604d9f1baea42b392de5b8659112e738dd0edca39239405babcc2f0f0fc7951450d840a0cbfbf08a9bc5b7bc984
|
7
|
+
data.tar.gz: 7061834b8255f32c9dabbc76a5a7d15711379c376d6b34733d1a90bc93e3ff994b1468ed03b20e0f9db221d2ba779f3d1386800965b63ba137a1f8c4e2cb4580
|
data/README.md
CHANGED
@@ -99,8 +99,12 @@ end
|
|
99
99
|
5. Create new Pull Request
|
100
100
|
|
101
101
|
|
102
|
-
|
103
|
-
|
102
|
+
## Links
|
103
|
+
|
104
|
+
- [Rails のモデル内のメソッドをソートするRubocop Extension を作った - pockestrap](http://pocke.hatenablog.com/entry/2016/03/04/232425) (Japanese Blog)
|
105
|
+
|
106
|
+
|
107
|
+
## License
|
104
108
|
|
105
109
|
These codes are licensed under CC0.
|
106
110
|
|
data/config/default.yml
CHANGED
@@ -49,14 +49,14 @@ module RuboCop
|
|
49
49
|
return unless body.begin_type?
|
50
50
|
|
51
51
|
targets = target_methods(body)
|
52
|
-
return if targets ==
|
52
|
+
return if targets == sort_methods(targets)
|
53
53
|
|
54
54
|
add_offense(body, :expression)
|
55
55
|
end
|
56
56
|
|
57
57
|
def autocorrect(body)
|
58
58
|
targets = target_methods(body)
|
59
|
-
sorteds =
|
59
|
+
sorteds = sort_methods(targets)
|
60
60
|
sorteds.push(nil)
|
61
61
|
|
62
62
|
lambda do |corrector|
|
@@ -101,7 +101,7 @@ module RuboCop
|
|
101
101
|
end
|
102
102
|
|
103
103
|
# TODO: Rename
|
104
|
-
def
|
104
|
+
def sort_methods(callbacks)
|
105
105
|
i = 0
|
106
106
|
callbacks.sort_by{|x| [target_method_names.find_index(x.method_name), i+=1]}
|
107
107
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails-order_model_declarative_methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|