active_record_callbacks_cop 0.1.1 → 0.2.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
  SHA256:
3
- metadata.gz: eafdc65ac1fbea22b83ba9ebc082fb6c8fe8dfabd285f666123fdb5174d41132
4
- data.tar.gz: c2eb4878eaa665a06fa0542746432f4723d767275a8e393269ba5f4e12faeca7
3
+ metadata.gz: ed5aeeab0dbabae7d8950a6b63b789324799494a32c838c816c694f96a5521df
4
+ data.tar.gz: 5c66d0f132c821466b2e3d15f82c19e867dafb3c1e5bfbe2a9ac936ad8abdd2b
5
5
  SHA512:
6
- metadata.gz: c20f610c2aae9bede419b456cf497e3a452de37c3b83a2efec1735693f4025e389a4a83a78fc4c356a69ad0039315f616738f21519c08b8d1c94061abdfbcaae
7
- data.tar.gz: f4a421b3d50365e7edc42bb3a3ca240d83b09a865c8c71d7c07161678cb94783d2452fa17e14b45ac95b3903773361b11563af960c43eda90dd783ec2a54a5eb
6
+ metadata.gz: 56158c76babf3f8b161fe7a4184400e20724ac682714605e761e8599e5f0953e746ddc01ac7ab02fa66c30f62c926fc24197dcb1c50b4d4fba6131a35a2e71ce
7
+ data.tar.gz: 0dd3cb356fa50bd82ff7081ae04122db54c4a6b524d4a51c8c64792483729421cbfba546e96e316df6fe8b52fb93f019eefe976957dd6fd8b0d6748ad6d9b692
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## RELEASE 0.2.0
2
+
3
+ * FEATURE: now also registers an offense on `before_validation`, `after_validation`, & `after_touch` callbacks
4
+
1
5
  ## RELEASE 0.1.1
2
6
 
3
7
  * FIX: the cop now doesn't break on non-model files (like, for example, rspec test files)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_record_callbacks_cop (0.1.1)
4
+ active_record_callbacks_cop (0.2.0)
5
5
  rubocop (>= 0.72.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -2,9 +2,23 @@
2
2
 
3
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.
4
4
 
5
+ These are the callbacks ActiveRecord provides:
6
+
7
+ - `before_validation`/`after_validation`
8
+ - `before_create`/`around_create`/`after_create`
9
+ - `before_save`/`around_save`/`after_save`
10
+ - `before_destroy`/`around_destroy`/`after_destroy`
11
+ - `after_touch`
12
+ - `after_commit`
13
+ - `after_create_commit`/`after_update_commit`/`after_destroy_commit`
14
+ - `after_rollback`
15
+ - `after_initialize`/`after_find`
16
+
17
+ This cop registers offenses whenever it sees any of these class methods called in `ApplicationRecord` or `ActiveRecord::Base` subclasses, except for `after_iniitalize` and `after_find`.
18
+
5
19
  ## Installation
6
20
 
7
- Just install the `active_record_callbacks_cop` gem
21
+ Install the `active_record_callbacks_cop` gem
8
22
 
9
23
  ```bash
10
24
  gem install active_record_callbacks_cop
@@ -1,7 +1,7 @@
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
@@ -108,7 +108,7 @@ GEM
108
108
  diff-lcs (>= 1.2.0, < 2.0)
109
109
  rspec-support (~> 3.8.0)
110
110
  rspec-support (3.8.2)
111
- rubocop (0.72.0)
111
+ rubocop (0.73.0)
112
112
  jaro_winkler (~> 1.5.1)
113
113
  parallel (~> 1.10)
114
114
  parser (>= 2.6)
@@ -1,7 +1,7 @@
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
@@ -124,7 +124,7 @@ GEM
124
124
  diff-lcs (>= 1.2.0, < 2.0)
125
125
  rspec-support (~> 3.8.0)
126
126
  rspec-support (3.8.2)
127
- rubocop (0.72.0)
127
+ rubocop (0.73.0)
128
128
  jaro_winkler (~> 1.5.1)
129
129
  parallel (~> 1.10)
130
130
  parser (>= 2.6)
@@ -1,7 +1,7 @@
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
@@ -135,7 +135,7 @@ GEM
135
135
  diff-lcs (>= 1.2.0, < 2.0)
136
136
  rspec-support (~> 3.8.0)
137
137
  rspec-support (3.8.2)
138
- rubocop (0.72.0)
138
+ rubocop (0.73.0)
139
139
  jaro_winkler (~> 1.5.1)
140
140
  parallel (~> 1.10)
141
141
  parser (>= 2.6)
@@ -23,18 +23,17 @@ module ActiveRecordCallbacksCop
23
23
  %w(ActiveRecord::Base ApplicationRecord)
24
24
  end
25
25
 
26
- # TODO: decide whether to ban before_validation/after_validation
27
- # TODO: decide whether to ban after_initialize/after_find
28
- # TODO: decide whether to ban after_touch
29
26
  # TODO: maybe there should be separate cops for groups of callbacks?
30
27
  def callback_names
31
28
  %i(
29
+ before_validation after_validation
32
30
  before_save around_save after_save
33
31
  before_create around_create after_create
34
32
  before_destroy around_destroy after_destroy
35
33
  after_commit
36
34
  after_create_commit after_update_commit after_destroy_commit
37
35
  after_rollback
36
+ after_touch
38
37
  )
39
38
  end
40
39
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordCallbacksCop
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
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.1
4
+ version: 0.2.0
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-19 00:00:00.000000000 Z
11
+ date: 2019-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler