Apply rubocop fixes to RoleManagement#20881
Apply rubocop fixes to RoleManagement#20881jrafanie merged 1 commit intoManageIQ:masterfrom djberg96:role_management
Conversation
|
@jrafanie Look ok? |
jrafanie
left a comment
There was a problem hiding this comment.
Sorry, for the slow review. I'm mostly good with the changes. A few comments are above.
| deactivate_roles(r.name) | ||
| end unless adds.empty? | ||
| adds = ServerRole.where(:name => (desired - current)) | ||
| unless adds.empty? |
There was a problem hiding this comment.
Interesting...I'm curious why this was in the original code at all... .each will effectively be a no-op anyway. Not for this PR, but this line can be removed in a follow-up
which one is the loop change? |
|
|
That one seems fine to me...it's a straight syntactical change. |
|
@djberg96 Can you squash commits? Otherwise the history shows a delete and a re-add which is confusing. |
lol, I just did that, gimme 2 minutes! ....ok done. |
|
Checked commit https://github.com/djberg96/manageiq/commit/ef3335109175b35492b09b17dd297c3944f91ec6 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint app/models/miq_server/role_management.rb
|
This applies all of the rubocop fixes that can be applied via
rubocop -Ato the RoleManagement class. It's a mix of formatting tweaks, usingaliasinstead ofalias_method, removal of redundantselfcalls, plus some changes to the way some loops are handled.Of these, I think the loop change might be the only one we might not want, in which case we should update the cop.