mavenlint 1.1.1 → 1.2.0
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/lib/mavenlint.rb +1 -0
- data/lib/rubocop/cop/mavenlint/use-application-record.rb +32 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e57e6b765719b7164b7c2e36263ae7d8b0a947d
|
4
|
+
data.tar.gz: df6b9495132aa2eb56678302654b73a83e31cb9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c156fe41059f0a195350808199859bdcb27813ab3342dc994e21f063f7f2568611793ec212d8b247a439d9978e9c8bbbd25ceda1a9b69af1a45182d3d2b027b1
|
7
|
+
data.tar.gz: 628f968c28e69f4061f42c7b55c5bff04aa16fc95f677f281454a704cfa50416f8174f474d7f8e94a0a4e0df6db67d40a3cb35c635ebd0ad641e9d6b77255bd6
|
data/lib/mavenlint.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubocop'
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Mavenlint
|
6
|
+
# Enforce models inheriting from ApplicationRecord instead of ActiveRecord::Base
|
7
|
+
#
|
8
|
+
# For example
|
9
|
+
#
|
10
|
+
# class SomeModel < ActiveRecord::Base
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# should be
|
14
|
+
#
|
15
|
+
# class SomeModel < ApplicationRecord
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# Note that this cop is built in to RuboCop. However, it only runs on Rails 5, and we want
|
19
|
+
# run it even though we're on Rails 4. Once we're on Rails 5, however, we should be able to
|
20
|
+
# remove this custom cop and enable the built-in one.
|
21
|
+
# @see https://github.com/bbatsov/rubocop/blob/10a7041d23bcd579821b378dd351aeead7c3f082/lib/rubocop/cop/rails/application_record.rb
|
22
|
+
#
|
23
|
+
class UseApplicationRecord < RuboCop::Cop::Cop
|
24
|
+
MSG = 'Models should subclass `ApplicationRecord`.'.freeze
|
25
|
+
SUPERCLASS = 'ApplicationRecord'.freeze
|
26
|
+
BASE_PATTERN = '(const (const nil? :ActiveRecord) :Base)'.freeze
|
27
|
+
|
28
|
+
include RuboCop::Cop::EnforceSuperclass
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mavenlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mavenlnk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.51'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.51'
|
55
55
|
description:
|
56
56
|
email:
|
57
57
|
- ahuth@mavenlink.com
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- lib/mavenlint.rb
|
63
63
|
- lib/rubocop/cop/mavenlint/unsafe-mass-assignment.rb
|
64
|
+
- lib/rubocop/cop/mavenlint/use-application-record.rb
|
64
65
|
- rubocop.yml
|
65
66
|
homepage: https://github.com/mavenlink/mavenlint
|
66
67
|
licenses:
|