-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve original callback execution order #313
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,9 +44,7 @@ class ActiveRecordCallbacksOrder < Cop | |
after_touch | ||
].freeze | ||
|
||
CALLBACKS_ORDER_MAP = Hash[ | ||
CALLBACKS_IN_ORDER.map.with_index { |name, index| [name, index] } | ||
].freeze | ||
CALLBACKS_ORDER_MAP = CALLBACKS_IN_ORDER.each_with_index.to_h.freeze | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change isn't necessary to fix the problem, but I thought it was a nice simplification. 🙂 I'll happily take it out if it's not welcome, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool 👍 |
||
|
||
def on_class(class_node) | ||
previous_index = -1 | ||
|
@@ -68,7 +66,7 @@ def on_class(class_node) | |
|
||
# Autocorrect by swapping between two nodes autocorrecting them | ||
def autocorrect(node) | ||
previous = left_siblings_of(node).find do |sibling| | ||
previous = left_siblings_of(node).reverse_each.find do |sibling| | ||
callback?(sibling) | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this in the wrong place in #312. 😩