callback_hell 0.2.0 → 0.2.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +14 -14
- data/lib/callback_hell/analyzers/callback_analyzer.rb +7 -3
- data/lib/callback_hell/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d4c93ffb49c622e2bec61ef6c52cc8b1811efbe1431450853171158ae7dbde
|
4
|
+
data.tar.gz: c7cff82da86a6c680b9d4e3b1b4749bfb7e29e3814e50e1535bc354b04ee957b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7801e52db155cbcc5cbd18b6bcc6178caa11e9f98831a814f48bf66d944dd2adf0f9dc9ce53288db62995335f66dbe3ff6efc358ebd1d0deb116325b3864065f
|
7
|
+
data.tar.gz: d5a0f91436781b3b0c0c9881b34bbe221f904735b3d23c7823aed9f5385cd7c66768fea2e53c19bf2104f3d6e3761fc95c2dd00cbdd086b00b6083d61637dbab
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,9 +4,7 @@
|
|
4
4
|
|
5
5
|
> You live in it.
|
6
6
|
|
7
|
-
Callback Hell is a Ruby gem
|
8
|
-
|
9
|
-
It analyzes your Rails application models and provides actionable insights on callbacks and validations. Use it to identify models that might benefit from refactoring, spot callback pollution from gems and associations, and keep your models clean and maintainable.
|
7
|
+
Callback Hell is a Ruby gem that analyzes your Ruby on Rails application models and provides actionable insights on callbacks and validations. Use it to identify models that might benefit from refactoring, spot callback pollution from gems and associations, and keep your models clean and maintainable.
|
10
8
|
|
11
9
|
<a href="https://evilmartians.com/?utm_source=callback_hell">
|
12
10
|
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
|
@@ -64,7 +62,7 @@ We support Ruby 3.0+ and Rails 7.0+.
|
|
64
62
|
|
65
63
|
## Usage
|
66
64
|
|
67
|
-
**Note:** you can use
|
65
|
+
**Note:** you can use either `rake` or `bin/rails` as you wish.
|
68
66
|
|
69
67
|
### Command line options
|
70
68
|
|
@@ -74,13 +72,13 @@ All rake tasks support the following options:
|
|
74
72
|
|
75
73
|
```bash
|
76
74
|
# Table format (default)
|
77
|
-
bin/rails
|
75
|
+
bin/rails ch:callbacks format=table
|
78
76
|
|
79
|
-
# Line format: detailed per-callback breakdown
|
80
|
-
bin/rails
|
77
|
+
# Line format: detailed per-callback breakdown
|
78
|
+
bin/rails ch:callbacks format=line
|
81
79
|
|
82
80
|
# GitHub Actions format for CI/CD
|
83
|
-
bin/rails
|
81
|
+
bin/rails ch:callbacks format=github
|
84
82
|
```
|
85
83
|
|
86
84
|
#### Model filtering
|
@@ -100,19 +98,19 @@ bin/rails ch model=Admin::User
|
|
100
98
|
|
101
99
|
```bash
|
102
100
|
# Sort by callback count (default)
|
103
|
-
bin/rails ch sort=
|
101
|
+
bin/rails ch sort=total
|
104
102
|
|
105
103
|
# Sort alphabetically
|
106
|
-
bin/rails ch sort=name
|
104
|
+
bin/rails ch sort=name
|
107
105
|
```
|
108
106
|
|
109
107
|
#### Analysis modes
|
110
108
|
|
111
109
|
```bash
|
112
|
-
# Default mode
|
110
|
+
# Default mode: your callbacks only
|
113
111
|
bin/rails ch mode=default
|
114
112
|
|
115
|
-
# Full mode
|
113
|
+
# Full mode: includes Rails internals and associations
|
116
114
|
bin/rails ch mode=full
|
117
115
|
```
|
118
116
|
|
@@ -161,9 +159,11 @@ jobs:
|
|
161
159
|
|
162
160
|
## Credits and acknowledgements
|
163
161
|
|
164
|
-
Callback Hell is a spiritual successor of the [arca](https://github.com/jonmagic/arca) gem by [Jonathan Hoyt](https://github.com/jonmagic).
|
162
|
+
Callback Hell is supposed to be a spiritual successor of the [arca](https://github.com/jonmagic/arca) gem by [Jonathan Hoyt](https://github.com/jonmagic).
|
163
|
+
|
164
|
+
The entire idea and a detailed specification for the gem were done by [Vladimir Dementyev](https://github.com/palkan) who initially offered it as a Ruby developer candidate take-home task for [Evil Martians](https://evilmartians.com/?utm_source=callback_hell).
|
165
165
|
|
166
|
-
|
166
|
+
Shout-out to [Adam Doppelt](https://github.com/gurgeous) for [table_tennis](https://github.com/gurgeous/table_tennis) that we use for formatting tables.
|
167
167
|
|
168
168
|
## Contributing
|
169
169
|
|
@@ -10,9 +10,13 @@ module CallbackHell
|
|
10
10
|
].freeze
|
11
11
|
|
12
12
|
RAILS_ATTRIBUTE_OWNERS = [
|
13
|
-
defined?(ActiveRecord::Normalization)
|
14
|
-
|
15
|
-
|
13
|
+
defined?(ActiveRecord::Normalization) &&
|
14
|
+
ActiveRecord::Normalization,
|
15
|
+
defined?(ActiveModel::Attributes::Normalization) &&
|
16
|
+
ActiveModel::Attributes::Normalization,
|
17
|
+
defined?(ActiveRecord::Encryption::EncryptableRecord) &&
|
18
|
+
ActiveRecord::Encryption::EncryptableRecord
|
19
|
+
].compact.freeze
|
16
20
|
|
17
21
|
def initialize(callback, model, defining_class)
|
18
22
|
@callback = callback
|