active_record_callbacks_cop 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4db2fcd041bfeea22def588a76d87bf96fbc4dd648dba79a25386efbaf895fd6
4
- data.tar.gz: 40ac329894f172825c117edf3f11ea57abbafd9f591fea3312c8ce480d2fd5af
3
+ metadata.gz: eafdc65ac1fbea22b83ba9ebc082fb6c8fe8dfabd285f666123fdb5174d41132
4
+ data.tar.gz: c2eb4878eaa665a06fa0542746432f4723d767275a8e393269ba5f4e12faeca7
5
5
  SHA512:
6
- metadata.gz: a21189611b54fa670aee7c43e08f4c66a9832525a0c83ed6be1f42f2408792e064efc8853e9aabc6a79b8e82bfaaeb26e63f4b41e6c35b91e212b0c23606ea74
7
- data.tar.gz: 60b19056d218832fdf1d66d9e157db1a03f7c0d9be19aeb2f83637aae6ca904a0b179b93c52fca88516068f1d3bd826ebf22ef49ae7240a7c67650674cd7b0d4
6
+ metadata.gz: c20f610c2aae9bede419b456cf497e3a452de37c3b83a2efec1735693f4025e389a4a83a78fc4c356a69ad0039315f616738f21519c08b8d1c94061abdfbcaae
7
+ data.tar.gz: f4a421b3d50365e7edc42bb3a3ca240d83b09a865c8c71d7c07161678cb94783d2452fa17e14b45ac95b3903773361b11563af960c43eda90dd783ec2a54a5eb
data/.travis.yml CHANGED
@@ -4,4 +4,9 @@ language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
6
  - 2.5.3
7
- before_install: gem install bundler -v 2.0.1
7
+ before_install: gem install bundler -v 1.17.3
8
+ gemfile:
9
+ - gemfiles/rails3.gemfile
10
+ - gemfiles/rails4.gemfile
11
+ - gemfiles/rails5.gemfile
12
+ script: bundle exec rspec
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise 'rails3' do
2
+ gem 'rails', '~> 3.2'
3
+ end
4
+
5
+ appraise 'rails4' do
6
+ gem 'rails', '~> 4.2'
7
+ end
8
+
9
+ appraise 'rails5' do
10
+ gem 'rails', '~> 5.2'
11
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## RELEASE 0.1.1
2
+
3
+ * FIX: the cop now doesn't break on non-model files (like, for example, rspec test files)
4
+
1
5
  ## RELEASE 0.1.0
2
6
 
3
7
  * FEATURE: this cop will register an offense if you try to use any ActiveRecord persistance callbacks in your ActiveRecord::Base or ApplicationRecord subclasses
data/Gemfile.lock CHANGED
@@ -1,12 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_record_callbacks_cop (0.1.0)
4
+ active_record_callbacks_cop (0.1.1)
5
5
  rubocop (>= 0.72.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ appraisal (2.2.0)
11
+ bundler
12
+ rake
13
+ thor (>= 0.14.0)
10
14
  ast (2.4.0)
11
15
  byebug (11.0.1)
12
16
  coderay (1.1.2)
@@ -40,7 +44,7 @@ GEM
40
44
  diff-lcs (>= 1.2.0, < 2.0)
41
45
  rspec-support (~> 3.8.0)
42
46
  rspec-support (3.8.2)
43
- rubocop (0.72.0)
47
+ rubocop (0.73.0)
44
48
  jaro_winkler (~> 1.5.1)
45
49
  parallel (~> 1.10)
46
50
  parser (>= 2.6)
@@ -55,6 +59,7 @@ GEM
55
59
  simplecov-html (0.10.2)
56
60
  structured_changelog (0.11.1)
57
61
  git
62
+ thor (0.20.3)
58
63
  unicode-display_width (1.6.0)
59
64
 
60
65
  PLATFORMS
@@ -62,7 +67,8 @@ PLATFORMS
62
67
 
63
68
  DEPENDENCIES
64
69
  active_record_callbacks_cop!
65
- bundler (~> 2.0)
70
+ appraisal
71
+ bundler (~> 1.17)
66
72
  pry-byebug
67
73
  rake (~> 10.0)
68
74
  rspec
@@ -70,4 +76,4 @@ DEPENDENCIES
70
76
  structured_changelog (~> 0.11)
71
77
 
72
78
  BUNDLED WITH
73
- 2.0.1
79
+ 1.17.3
data/README.md CHANGED
@@ -1,28 +1,56 @@
1
1
  # ActiveRecordCallbacksCop
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/active_record_callbacks_cop`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Use this [RuboCop](https://github.com/rubocop-hq/rubocop) extension to stop yourself from using ActiveRecord callbacks. They'll only hurt you in the long run and its best to avoid them from the start.
6
4
 
7
5
  ## Installation
8
6
 
9
- Add this line to your application's Gemfile:
7
+ Just install the `active_record_callbacks_cop` gem
10
8
 
11
- ```ruby
9
+ ```bash
10
+ gem install active_record_callbacks_cop
11
+ ```
12
+
13
+ or if you use bundler put this in your `Gemfile`
14
+
15
+ ```
12
16
  gem 'active_record_callbacks_cop'
13
17
  ```
14
18
 
15
- And then execute:
19
+ ## Usage
16
20
 
17
- $ bundle
21
+ You need to tell RuboCop to load the RSpec extension. There are three ways to do this:
18
22
 
19
- Or install it yourself as:
23
+ ### RuboCop configuration file
20
24
 
21
- $ gem install active_record_callbacks_cop
25
+ Put this into your `.rubocop.yml`.
22
26
 
23
- ## Usage
27
+ ```yaml
28
+ require: active_record_callbacks_cop
29
+ ```
30
+
31
+ Alternatively, use the following array notation when specifying multiple extensions.
24
32
 
25
- TODO: Write usage instructions here
33
+ ```yaml
34
+ require:
35
+ - rubocop-other-extension
36
+ - active_record_callbacks_cop
37
+ ```
38
+
39
+ Now you can run `rubocop` and it will automatically load this cop together with your other cops.
40
+
41
+ ### Command line
42
+
43
+ ```bash
44
+ rubocop --require active_record_callbacks_cop
45
+ ```
46
+
47
+ ### Rake task
48
+
49
+ ```ruby
50
+ RuboCop::RakeTask.new do |task|
51
+ task.requires << 'active_record_callbacks_cop'
52
+ end
53
+ ```
26
54
 
27
55
  ## Development
28
56
 
@@ -22,9 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", "~> 2.0"
25
+ spec.add_development_dependency "bundler", "~> 1.17"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency "appraisal"
28
29
 
29
30
  spec.add_dependency "rubocop", ">= 0.72.0" # just copied rubocop-rails' dependency constraint for this
30
31
  end
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "structured_changelog", "~> 0.11"
6
+ gem "simplecov"
7
+ gem "rspec"
8
+ gem "pry-byebug"
9
+ gem "rails", "~> 3.2"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,154 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_callbacks_cop (0.1.0)
5
+ rubocop (>= 0.72.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.22.5)
11
+ actionpack (= 3.2.22.5)
12
+ mail (~> 2.5.4)
13
+ actionpack (3.2.22.5)
14
+ activemodel (= 3.2.22.5)
15
+ activesupport (= 3.2.22.5)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.22.5)
24
+ activesupport (= 3.2.22.5)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.22.5)
27
+ activemodel (= 3.2.22.5)
28
+ activesupport (= 3.2.22.5)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.22.5)
32
+ activemodel (= 3.2.22.5)
33
+ activesupport (= 3.2.22.5)
34
+ activesupport (3.2.22.5)
35
+ i18n (~> 0.6, >= 0.6.4)
36
+ multi_json (~> 1.0)
37
+ appraisal (2.2.0)
38
+ bundler
39
+ rake
40
+ thor (>= 0.14.0)
41
+ arel (3.0.3)
42
+ ast (2.4.0)
43
+ builder (3.0.4)
44
+ byebug (11.0.1)
45
+ coderay (1.1.2)
46
+ concurrent-ruby (1.1.5)
47
+ diff-lcs (1.3)
48
+ docile (1.3.2)
49
+ erubis (2.7.0)
50
+ git (1.5.0)
51
+ hike (1.2.3)
52
+ i18n (0.9.5)
53
+ concurrent-ruby (~> 1.0)
54
+ jaro_winkler (1.5.3)
55
+ journey (1.0.4)
56
+ json (2.2.0)
57
+ mail (2.5.5)
58
+ mime-types (~> 1.16)
59
+ treetop (~> 1.4.8)
60
+ method_source (0.9.2)
61
+ mime-types (1.25.1)
62
+ multi_json (1.13.1)
63
+ parallel (1.17.0)
64
+ parser (2.6.3.0)
65
+ ast (~> 2.4.0)
66
+ polyglot (0.3.5)
67
+ pry (0.12.2)
68
+ coderay (~> 1.1.0)
69
+ method_source (~> 0.9.0)
70
+ pry-byebug (3.7.0)
71
+ byebug (~> 11.0)
72
+ pry (~> 0.10)
73
+ rack (1.4.7)
74
+ rack-cache (1.9.0)
75
+ rack (>= 0.4)
76
+ rack-ssl (1.3.4)
77
+ rack
78
+ rack-test (0.6.3)
79
+ rack (>= 1.0)
80
+ rails (3.2.22.5)
81
+ actionmailer (= 3.2.22.5)
82
+ actionpack (= 3.2.22.5)
83
+ activerecord (= 3.2.22.5)
84
+ activeresource (= 3.2.22.5)
85
+ activesupport (= 3.2.22.5)
86
+ bundler (~> 1.0)
87
+ railties (= 3.2.22.5)
88
+ railties (3.2.22.5)
89
+ actionpack (= 3.2.22.5)
90
+ activesupport (= 3.2.22.5)
91
+ rack-ssl (~> 1.3.2)
92
+ rake (>= 0.8.7)
93
+ rdoc (~> 3.4)
94
+ thor (>= 0.14.6, < 2.0)
95
+ rainbow (3.0.0)
96
+ rake (10.5.0)
97
+ rdoc (3.9.5)
98
+ rspec (3.8.0)
99
+ rspec-core (~> 3.8.0)
100
+ rspec-expectations (~> 3.8.0)
101
+ rspec-mocks (~> 3.8.0)
102
+ rspec-core (3.8.2)
103
+ rspec-support (~> 3.8.0)
104
+ rspec-expectations (3.8.4)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.8.0)
107
+ rspec-mocks (3.8.1)
108
+ diff-lcs (>= 1.2.0, < 2.0)
109
+ rspec-support (~> 3.8.0)
110
+ rspec-support (3.8.2)
111
+ rubocop (0.72.0)
112
+ jaro_winkler (~> 1.5.1)
113
+ parallel (~> 1.10)
114
+ parser (>= 2.6)
115
+ rainbow (>= 2.2.2, < 4.0)
116
+ ruby-progressbar (~> 1.7)
117
+ unicode-display_width (>= 1.4.0, < 1.7)
118
+ ruby-progressbar (1.10.1)
119
+ simplecov (0.17.0)
120
+ docile (~> 1.1)
121
+ json (>= 1.8, < 3)
122
+ simplecov-html (~> 0.10.0)
123
+ simplecov-html (0.10.2)
124
+ sprockets (2.2.3)
125
+ hike (~> 1.2)
126
+ multi_json (~> 1.0)
127
+ rack (~> 1.0)
128
+ tilt (~> 1.1, != 1.3.0)
129
+ structured_changelog (0.11.1)
130
+ git
131
+ thor (0.20.3)
132
+ tilt (1.4.1)
133
+ treetop (1.4.15)
134
+ polyglot
135
+ polyglot (>= 0.3.1)
136
+ tzinfo (0.3.55)
137
+ unicode-display_width (1.6.0)
138
+
139
+ PLATFORMS
140
+ ruby
141
+
142
+ DEPENDENCIES
143
+ active_record_callbacks_cop!
144
+ appraisal
145
+ bundler (~> 1.17)
146
+ pry-byebug
147
+ rails (~> 3.2)
148
+ rake (~> 10.0)
149
+ rspec
150
+ simplecov
151
+ structured_changelog (~> 0.11)
152
+
153
+ BUNDLED WITH
154
+ 1.17.3
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "structured_changelog", "~> 0.11"
6
+ gem "simplecov"
7
+ gem "rspec"
8
+ gem "pry-byebug"
9
+ gem "rails", "~> 4.2"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,170 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_callbacks_cop (0.1.0)
5
+ rubocop (>= 0.72.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.2.9)
11
+ actionpack (= 4.2.9)
12
+ actionview (= 4.2.9)
13
+ activejob (= 4.2.9)
14
+ mail (~> 2.5, >= 2.5.4)
15
+ rails-dom-testing (~> 1.0, >= 1.0.5)
16
+ actionpack (4.2.9)
17
+ actionview (= 4.2.9)
18
+ activesupport (= 4.2.9)
19
+ rack (~> 1.6)
20
+ rack-test (~> 0.6.2)
21
+ rails-dom-testing (~> 1.0, >= 1.0.5)
22
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
23
+ actionview (4.2.9)
24
+ activesupport (= 4.2.9)
25
+ builder (~> 3.1)
26
+ erubis (~> 2.7.0)
27
+ rails-dom-testing (~> 1.0, >= 1.0.5)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
29
+ activejob (4.2.9)
30
+ activesupport (= 4.2.9)
31
+ globalid (>= 0.3.0)
32
+ activemodel (4.2.9)
33
+ activesupport (= 4.2.9)
34
+ builder (~> 3.1)
35
+ activerecord (4.2.9)
36
+ activemodel (= 4.2.9)
37
+ activesupport (= 4.2.9)
38
+ arel (~> 6.0)
39
+ activesupport (4.2.9)
40
+ i18n (~> 0.7)
41
+ minitest (~> 5.1)
42
+ thread_safe (~> 0.3, >= 0.3.4)
43
+ tzinfo (~> 1.1)
44
+ appraisal (2.2.0)
45
+ bundler
46
+ rake
47
+ thor (>= 0.14.0)
48
+ arel (6.0.4)
49
+ ast (2.4.0)
50
+ builder (3.2.3)
51
+ byebug (11.0.1)
52
+ coderay (1.1.2)
53
+ concurrent-ruby (1.1.5)
54
+ crass (1.0.4)
55
+ diff-lcs (1.3)
56
+ docile (1.3.2)
57
+ erubis (2.7.0)
58
+ git (1.5.0)
59
+ globalid (0.4.2)
60
+ activesupport (>= 4.2.0)
61
+ i18n (0.9.5)
62
+ concurrent-ruby (~> 1.0)
63
+ jaro_winkler (1.5.3)
64
+ json (2.2.0)
65
+ loofah (2.2.3)
66
+ crass (~> 1.0.2)
67
+ nokogiri (>= 1.5.9)
68
+ mail (2.7.1)
69
+ mini_mime (>= 0.1.1)
70
+ method_source (0.9.2)
71
+ mini_mime (1.0.2)
72
+ mini_portile2 (2.4.0)
73
+ minitest (5.11.3)
74
+ nokogiri (1.10.3)
75
+ mini_portile2 (~> 2.4.0)
76
+ parallel (1.17.0)
77
+ parser (2.6.3.0)
78
+ ast (~> 2.4.0)
79
+ pry (0.12.2)
80
+ coderay (~> 1.1.0)
81
+ method_source (~> 0.9.0)
82
+ pry-byebug (3.7.0)
83
+ byebug (~> 11.0)
84
+ pry (~> 0.10)
85
+ rack (1.6.8)
86
+ rack-test (0.6.3)
87
+ rack (>= 1.0)
88
+ rails (4.2.9)
89
+ actionmailer (= 4.2.9)
90
+ actionpack (= 4.2.9)
91
+ actionview (= 4.2.9)
92
+ activejob (= 4.2.9)
93
+ activemodel (= 4.2.9)
94
+ activerecord (= 4.2.9)
95
+ activesupport (= 4.2.9)
96
+ bundler (>= 1.3.0, < 2.0)
97
+ railties (= 4.2.9)
98
+ sprockets-rails
99
+ rails-deprecated_sanitizer (1.0.3)
100
+ activesupport (>= 4.2.0.alpha)
101
+ rails-dom-testing (1.0.8)
102
+ activesupport (>= 4.2.0.beta, < 5.0)
103
+ nokogiri (~> 1.6)
104
+ rails-deprecated_sanitizer (>= 1.0.1)
105
+ rails-html-sanitizer (1.0.4)
106
+ loofah (~> 2.2, >= 2.2.2)
107
+ railties (4.2.9)
108
+ actionpack (= 4.2.9)
109
+ activesupport (= 4.2.9)
110
+ rake (>= 0.8.7)
111
+ thor (>= 0.18.1, < 2.0)
112
+ rainbow (3.0.0)
113
+ rake (10.5.0)
114
+ rspec (3.8.0)
115
+ rspec-core (~> 3.8.0)
116
+ rspec-expectations (~> 3.8.0)
117
+ rspec-mocks (~> 3.8.0)
118
+ rspec-core (3.8.2)
119
+ rspec-support (~> 3.8.0)
120
+ rspec-expectations (3.8.4)
121
+ diff-lcs (>= 1.2.0, < 2.0)
122
+ rspec-support (~> 3.8.0)
123
+ rspec-mocks (3.8.1)
124
+ diff-lcs (>= 1.2.0, < 2.0)
125
+ rspec-support (~> 3.8.0)
126
+ rspec-support (3.8.2)
127
+ rubocop (0.72.0)
128
+ jaro_winkler (~> 1.5.1)
129
+ parallel (~> 1.10)
130
+ parser (>= 2.6)
131
+ rainbow (>= 2.2.2, < 4.0)
132
+ ruby-progressbar (~> 1.7)
133
+ unicode-display_width (>= 1.4.0, < 1.7)
134
+ ruby-progressbar (1.10.1)
135
+ simplecov (0.17.0)
136
+ docile (~> 1.1)
137
+ json (>= 1.8, < 3)
138
+ simplecov-html (~> 0.10.0)
139
+ simplecov-html (0.10.2)
140
+ sprockets (3.7.2)
141
+ concurrent-ruby (~> 1.0)
142
+ rack (> 1, < 3)
143
+ sprockets-rails (3.2.1)
144
+ actionpack (>= 4.0)
145
+ activesupport (>= 4.0)
146
+ sprockets (>= 3.0.0)
147
+ structured_changelog (0.11.1)
148
+ git
149
+ thor (0.20.3)
150
+ thread_safe (0.3.6)
151
+ tzinfo (1.2.5)
152
+ thread_safe (~> 0.1)
153
+ unicode-display_width (1.6.0)
154
+
155
+ PLATFORMS
156
+ ruby
157
+
158
+ DEPENDENCIES
159
+ active_record_callbacks_cop!
160
+ appraisal
161
+ bundler (~> 1.17)
162
+ pry-byebug
163
+ rails (~> 4.2)
164
+ rake (~> 10.0)
165
+ rspec
166
+ simplecov
167
+ structured_changelog (~> 0.11)
168
+
169
+ BUNDLED WITH
170
+ 1.17.3
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "structured_changelog", "~> 0.11"
6
+ gem "simplecov"
7
+ gem "rspec"
8
+ gem "pry-byebug"
9
+ gem "rails", "~> 5.2"
10
+
11
+ gemspec path: "../"
@@ -0,0 +1,184 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ active_record_callbacks_cop (0.1.0)
5
+ rubocop (>= 0.72.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.2.3)
11
+ actionpack (= 5.2.3)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailer (5.2.3)
15
+ actionpack (= 5.2.3)
16
+ actionview (= 5.2.3)
17
+ activejob (= 5.2.3)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.2.3)
21
+ actionview (= 5.2.3)
22
+ activesupport (= 5.2.3)
23
+ rack (~> 2.0)
24
+ rack-test (>= 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.2.3)
28
+ activesupport (= 5.2.3)
29
+ builder (~> 3.1)
30
+ erubi (~> 1.4)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.2.3)
34
+ activesupport (= 5.2.3)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.2.3)
37
+ activesupport (= 5.2.3)
38
+ activerecord (5.2.3)
39
+ activemodel (= 5.2.3)
40
+ activesupport (= 5.2.3)
41
+ arel (>= 9.0)
42
+ activestorage (5.2.3)
43
+ actionpack (= 5.2.3)
44
+ activerecord (= 5.2.3)
45
+ marcel (~> 0.3.1)
46
+ activesupport (5.2.3)
47
+ concurrent-ruby (~> 1.0, >= 1.0.2)
48
+ i18n (>= 0.7, < 2)
49
+ minitest (~> 5.1)
50
+ tzinfo (~> 1.1)
51
+ appraisal (2.2.0)
52
+ bundler
53
+ rake
54
+ thor (>= 0.14.0)
55
+ arel (9.0.0)
56
+ ast (2.4.0)
57
+ builder (3.2.3)
58
+ byebug (11.0.1)
59
+ coderay (1.1.2)
60
+ concurrent-ruby (1.1.5)
61
+ crass (1.0.4)
62
+ diff-lcs (1.3)
63
+ docile (1.3.2)
64
+ erubi (1.8.0)
65
+ git (1.5.0)
66
+ globalid (0.4.2)
67
+ activesupport (>= 4.2.0)
68
+ i18n (1.6.0)
69
+ concurrent-ruby (~> 1.0)
70
+ jaro_winkler (1.5.3)
71
+ json (2.2.0)
72
+ loofah (2.2.3)
73
+ crass (~> 1.0.2)
74
+ nokogiri (>= 1.5.9)
75
+ mail (2.7.1)
76
+ mini_mime (>= 0.1.1)
77
+ marcel (0.3.3)
78
+ mimemagic (~> 0.3.2)
79
+ method_source (0.9.2)
80
+ mimemagic (0.3.3)
81
+ mini_mime (1.0.2)
82
+ mini_portile2 (2.4.0)
83
+ minitest (5.11.3)
84
+ nio4r (2.4.0)
85
+ nokogiri (1.10.3)
86
+ mini_portile2 (~> 2.4.0)
87
+ parallel (1.17.0)
88
+ parser (2.6.3.0)
89
+ ast (~> 2.4.0)
90
+ pry (0.12.2)
91
+ coderay (~> 1.1.0)
92
+ method_source (~> 0.9.0)
93
+ pry-byebug (3.7.0)
94
+ byebug (~> 11.0)
95
+ pry (~> 0.10)
96
+ rack (2.0.7)
97
+ rack-test (1.1.0)
98
+ rack (>= 1.0, < 3)
99
+ rails (5.2.3)
100
+ actioncable (= 5.2.3)
101
+ actionmailer (= 5.2.3)
102
+ actionpack (= 5.2.3)
103
+ actionview (= 5.2.3)
104
+ activejob (= 5.2.3)
105
+ activemodel (= 5.2.3)
106
+ activerecord (= 5.2.3)
107
+ activestorage (= 5.2.3)
108
+ activesupport (= 5.2.3)
109
+ bundler (>= 1.3.0)
110
+ railties (= 5.2.3)
111
+ sprockets-rails (>= 2.0.0)
112
+ rails-dom-testing (2.0.3)
113
+ activesupport (>= 4.2.0)
114
+ nokogiri (>= 1.6)
115
+ rails-html-sanitizer (1.0.4)
116
+ loofah (~> 2.2, >= 2.2.2)
117
+ railties (5.2.3)
118
+ actionpack (= 5.2.3)
119
+ activesupport (= 5.2.3)
120
+ method_source
121
+ rake (>= 0.8.7)
122
+ thor (>= 0.19.0, < 2.0)
123
+ rainbow (3.0.0)
124
+ rake (10.5.0)
125
+ rspec (3.8.0)
126
+ rspec-core (~> 3.8.0)
127
+ rspec-expectations (~> 3.8.0)
128
+ rspec-mocks (~> 3.8.0)
129
+ rspec-core (3.8.2)
130
+ rspec-support (~> 3.8.0)
131
+ rspec-expectations (3.8.4)
132
+ diff-lcs (>= 1.2.0, < 2.0)
133
+ rspec-support (~> 3.8.0)
134
+ rspec-mocks (3.8.1)
135
+ diff-lcs (>= 1.2.0, < 2.0)
136
+ rspec-support (~> 3.8.0)
137
+ rspec-support (3.8.2)
138
+ rubocop (0.72.0)
139
+ jaro_winkler (~> 1.5.1)
140
+ parallel (~> 1.10)
141
+ parser (>= 2.6)
142
+ rainbow (>= 2.2.2, < 4.0)
143
+ ruby-progressbar (~> 1.7)
144
+ unicode-display_width (>= 1.4.0, < 1.7)
145
+ ruby-progressbar (1.10.1)
146
+ simplecov (0.17.0)
147
+ docile (~> 1.1)
148
+ json (>= 1.8, < 3)
149
+ simplecov-html (~> 0.10.0)
150
+ simplecov-html (0.10.2)
151
+ sprockets (3.7.2)
152
+ concurrent-ruby (~> 1.0)
153
+ rack (> 1, < 3)
154
+ sprockets-rails (3.2.1)
155
+ actionpack (>= 4.0)
156
+ activesupport (>= 4.0)
157
+ sprockets (>= 3.0.0)
158
+ structured_changelog (0.11.1)
159
+ git
160
+ thor (0.20.3)
161
+ thread_safe (0.3.6)
162
+ tzinfo (1.2.5)
163
+ thread_safe (~> 0.1)
164
+ unicode-display_width (1.6.0)
165
+ websocket-driver (0.7.1)
166
+ websocket-extensions (>= 0.1.0)
167
+ websocket-extensions (0.1.4)
168
+
169
+ PLATFORMS
170
+ ruby
171
+
172
+ DEPENDENCIES
173
+ active_record_callbacks_cop!
174
+ appraisal
175
+ bundler (~> 1.17)
176
+ pry-byebug
177
+ rails (~> 5.2)
178
+ rake (~> 10.0)
179
+ rspec
180
+ simplecov
181
+ structured_changelog (~> 0.11)
182
+
183
+ BUNDLED WITH
184
+ 1.17.3
@@ -6,11 +6,13 @@ module ActiveRecordCallbacksCop
6
6
  "ActiveRecordCallbacks"
7
7
  end
8
8
 
9
- MSG = "Don't use ActiveRecord callbacks"
9
+ MSG = "Don't use ActiveRecord callbacks to add logic to your database interactions."
10
10
 
11
11
  def on_send(node)
12
- return unless parent_class_names.include?(node.parent.parent_class.const_name)
13
12
  return unless callback_names.include?(node.method_name)
13
+ return unless node.parent.class_type? &&
14
+ node.parent.parent_class &&
15
+ parent_class_names.include?(node.parent.parent_class.const_name)
14
16
 
15
17
  add_offense(node)
16
18
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordCallbacksCop
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_callbacks_cop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hoffman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-13 00:00:00.000000000 Z
11
+ date: 2019-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '1.17'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '1.17'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: appraisal
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +91,7 @@ files:
77
91
  - ".gitignore"
78
92
  - ".rspec"
79
93
  - ".travis.yml"
94
+ - Appraisals
80
95
  - CHANGELOG.md
81
96
  - CODE_OF_CONDUCT.md
82
97
  - Gemfile
@@ -86,6 +101,13 @@ files:
86
101
  - active_record_callbacks_cop.gemspec
87
102
  - bin/console
88
103
  - bin/setup
104
+ - gemfiles/.bundle/config
105
+ - gemfiles/rails3.gemfile
106
+ - gemfiles/rails3.gemfile.lock
107
+ - gemfiles/rails4.gemfile
108
+ - gemfiles/rails4.gemfile.lock
109
+ - gemfiles/rails5.gemfile
110
+ - gemfiles/rails5.gemfile.lock
89
111
  - lib/active_record_callbacks_cop.rb
90
112
  - lib/active_record_callbacks_cop/cop.rb
91
113
  - lib/active_record_callbacks_cop/version.rb