-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
Refactor/abc condition #450
Conversation
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.
Good to see this getting cleaned up 👍. Just a few small nits.
delete_environment_variable 'BUNDLE_BIN_PATH' | ||
delete_environment_variable 'BUNDLE_GEMFILE' | ||
command_result = run_rails_new_command(options) | ||
validate_rails_new_success(command_result) |
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 think this method will be clearer if run_rails_new_command
and validate_rails_new_success
are merged. I think it also makes sense to have validation be part of the running.
env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue | ||
env['action_dispatch.show_exceptions'] = !env['action_dispatch.show_detailed_exceptions'] |
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.
Nice!
emulated_method&.casecmp(method)&.zero? | ||
end | ||
|
||
def add_hidden_input(document, js_form) |
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.
How about naming this add_hidden_method_input
?
|
||
js_form | ||
end | ||
|
||
def same?(emulated_method, method) | ||
emulated_method&.casecmp(method)&.zero? |
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.
This line tells me that emulated_method
is never nil
, so the safe calls can be removed.
end | ||
|
||
def csrf_and_non_get?(emulated_method) | ||
csrf? && !emulated_method.casecmp('get').zero? |
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.
Here, you can use !same?(emulated_method, 'get')
.
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.
Summary
Fix up some rubocop todo's
Details
Refactor some complex methods. Use better names where appropriate
Motivation and Context
Fixes up todo file in rubocop_todo.yml
How Has This Been Tested?
CI
Types of changes
Checklist: