rubocop-github 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubocop/cop/github/rails_application_record.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d42ae8bd8c8eeef0abfcd1d6560f1e74dd0e528
|
4
|
+
data.tar.gz: 121f88f09c74fbced513562a09cee6496d6c63cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b51ddf7214f92505176be5d3bf9829ed297b73d08a69753c8ff083286534593297190c236f35562503c408e9b7a728f4399e5c5eb60da3880ee64eae59f21592
|
7
|
+
data.tar.gz: e89b66df87c492ea490f559dc02c57e7a16b60c516df0c43497800a269e6a541d491901a4812c568a98e19268841309d82b64f8879d90297b509635ceb0460e6
|
@@ -6,12 +6,18 @@ module RuboCop
|
|
6
6
|
class RailsApplicationRecord < Cop
|
7
7
|
MSG = "Models should subclass from ApplicationRecord"
|
8
8
|
|
9
|
-
|
9
|
+
def_node_matcher :active_record_base_const?, <<-PATTERN
|
10
|
+
(const (const nil :ActiveRecord) :Base)
|
11
|
+
PATTERN
|
12
|
+
|
13
|
+
def_node_matcher :application_record_const?, <<-PATTERN
|
14
|
+
(const nil :ApplicationRecord)
|
15
|
+
PATTERN
|
10
16
|
|
11
17
|
def on_class(node)
|
12
|
-
|
18
|
+
klass, superclass, _ = *node
|
13
19
|
|
14
|
-
if superclass
|
20
|
+
if active_record_base_const?(superclass) && !(application_record_const?(klass))
|
15
21
|
add_offense(superclass, :expression)
|
16
22
|
end
|
17
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|