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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 555421aa2cc53e575da72b3cba366da68bf3fb24
4
- data.tar.gz: 1388a6d13b3bb1c5ea6eac1a2daefee3ba6940e6
3
+ metadata.gz: 3d42ae8bd8c8eeef0abfcd1d6560f1e74dd0e528
4
+ data.tar.gz: 121f88f09c74fbced513562a09cee6496d6c63cd
5
5
  SHA512:
6
- metadata.gz: fd9916223efc935f40e2c09cb60efb91d04304ea826fbfcf6bf1e5abb308d4a91de85cf6eca10e783dbd76d2f3c500e93004ef85abfb700de52cc985ce28fd58
7
- data.tar.gz: b2c7ba42d4a986b37a045913be8490776848a09f38a5bccf49af02caf4384690c1b963955299293cff2c2a9561c0c57cce71839c946c81a84967844731464fb6
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
- ACTIVE_RECORD_BASE = s(:const, s(:const, nil, :ActiveRecord), :Base)
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
- _name, superclass, _body = *node
18
+ klass, superclass, _ = *node
13
19
 
14
- if superclass == ACTIVE_RECORD_BASE
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.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-15 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop