-
Notifications
You must be signed in to change notification settings - Fork 120
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 AE Content Task Finished method and add spec #589
Refactor AE Content Task Finished method and add spec #589
Conversation
Pull Request Test Coverage Report for Build 3809
💛 - Coveralls |
d5aea24
to
31de2a3
Compare
31de2a3
to
9ba87f8
Compare
Hi @GregP Can you address the rubocop issue? |
...te/ManageIQ/System/CommonMethods/StateMachineMethods.class/__methods__/task_finished_spec.rb
Show resolved
Hide resolved
9ba87f8
to
16d02c8
Compare
@handle.create_notification(:type => :automate_service_provisioned, :subject => task.destination) if task.miq_request_task.nil? | ||
when 'miq_provision' | ||
final_message += "VM [#{task.get_option(:vm_target_name)}] " | ||
final_message += "IP [#{task.vm.ipaddresses.first}] " if task.vm && !task.vm.ipaddresses.blank? |
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.
@GregP Rubocop called out this line which @tinaafitz was referencing in her comment. Along the the rubocop recommendation to use present?
the condition can be simplified to:
if task.vm&.ipaddresses.present?
4d730e1
to
3ff16a0
Compare
@handle.create_notification(:type => :automate_service_provisioned, :subject => task.destination) if task.miq_request_task.nil? | ||
when 'miq_provision' | ||
final_message += "VM [#{task.get_option(:vm_target_name)}] " | ||
final_message += "IP [#{task.vm.ipaddresses.first}] " if task.vm.ipaddresses.present? |
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.
@GregP Thanks for updating this but you missed the &
mentioned in my original comment #589 (comment) which adds safe navigation to the condition in place of the multi-part AND condition: if @task.vm && [email protected]?
See http://mitrev.net/ruby/2015/11/13/the-operator-in-ruby
This should really be: if task.vm&.ipaddresses.present?
3ff16a0
to
d5d7b7b
Compare
Checked commit GregP@d5d7b7b with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
State Machine task finished method refactoring.
This PR is based on the issue below:
ManageIQ/manageiq#12038
@miq-bot add_label refactoring