-
Notifications
You must be signed in to change notification settings - Fork 25
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
[#499] Create a Rubocop cop for ordering instructions in class (e.g. Models) #509
[#499] Create a Rubocop cop for ordering instructions in class (e.g. Models) #509
Conversation
be94524
to
64e481d
Compare
Sorry I was a bit busy. I'll try to review next Monday (I blocked some time in my calendar for it 🙇 ) |
|
||
add_offense( | ||
second[:expression], | ||
message: error_message(second[:category], expressions.pluck(:category)) |
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.
message: error_message(second[:category], expressions.pluck(:category)) | |
message: error_message(second[:category], expressions.map { |expression| expression[:category] }) |
I tried in the CX project, but it seems that the Rails helpers could not be loaded. More over, in case we want to reuse this cop in a non Rails project, it can be nice to use pure Ruby only :)

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.
Oh absolutely 👍 . Fixed in 8b5fce5
I didn't realize that :pluck
is one of the niceties from Rails 🙈
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.
bf2ae9f
to
8b5fce5
Compare
Great suggestion. Added in f9fe5e6 Your example will now display this error instead: ![]() |
d8385eb
to
da7c883
Compare
da7c883
to
54e41c8
Compare
54e41c8
to
f9fe5e6
Compare
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.
Approved ahead, but we need to resolve the tests 🙇
f9fe5e6
to
0eece68
Compare
18fde8b
to
6b91a81
Compare
What happened 👀
Enforce class template with custom Rubocop rule
https://nimblehq.co/compass/development/code-conventions/ruby/#convention-40
Insight 📝
The cop is divided into two phases:
:unknown
Proof Of Work 📹
Project bootstrap
Untitled.mp4
Linter example
Screen-Recording-2024-03-29-at-1.35.03-PM.mp4