-
Notifications
You must be signed in to change notification settings - Fork 553
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
Make compatible with latest RuboCop #448
Conversation
return @result if defined? @result | ||
SimpleCov::ResultMerger.merged_result | ||
elsif defined? @result | ||
@result if defined? @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 like the approach, but this changes the logic, you're missing an else SimpleCov::ResultMerger.merged_result
case here to keep it in line with the previous version, no?
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.
Whoops, I think the right move is to get rid of the now-redundant if defined? @result
. On the way.
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.
Reading this method makes me dizzy, maybe we get to untangle this a bit:
def result
# Ensure the variable is defined to avoid ruby warnings
@result = nil unless defined?(@result)
# Collect our coverage result
if running and not result?
@result = SimpleCov::Result.new add_not_loaded_files(Coverage.result)
end
# If we're using merging of results, store the current result
# first, then merge the results and return those
if use_merging
if result?
SimpleCov::ResultMerger.store_result @result
end
SimpleCov::ResultMerger.merged_result
else
@result
end
ensure
self.running = false
end
22bf8ac
to
09944ba
Compare
else | ||
fail "Item does not match label" | ||
end | ||
return true if item == label |
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 know this is not applied to all of the code base and this especially is "just" our test sample code, but personally I prefer the actual if/else form because it's easier to parse the control flow of the method
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.
Sure. Would you like me to disable that cop completely or special case this file?
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.
Which one is it and what is it complaining about? Can't see anything in the build log :(
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.
That would be the Style::GuardClause
cop, which says:
Use a guard clause instead of wrapping the code inside a conditional expression.
7683485
to
241de7f
Compare
I've added the refactor of the |
Also, I think it'd be prudent to consider locking Would you be open to me making that change? |
@colszowka When you get a chance, I'm waiting on feedback on two points in order to proceed:
|
Thanks for keeping up on this thing!
Thanks again On Fri, Jan 22, 2016 at 2:14 PM -0800, "Craig Little" notifications@github.com wrote: @colszowka When you get a chance, I'm waiting on feedback on two points in order to proceed: What should we do about the Style/GuardClause cop? — |
241de7f
to
6bc590e
Compare
This brings it up-to-date for `v0.36.0`. Changelog: https://github.com/bbatsov/rubocop/blob/master/CHANGELOG.md#0360-14012016
Since `rubocop` is pre-1.0, breaking changes are often introduced with each minor version release. By locking to a minor version series, we can update to the latest on our own schedule and avoid unexpected build failures in the meantime.
This gets the build to green for now. An issue will be opened to discuss what to do with this cop going forward.
6bc590e
to
dfe701b
Compare
Locked to the And the build's 💚! |
Make compatible with latest RuboCop
Perfect, thanks @craiglittle |
This brings it up-to-date for
v0.36.0
.Changelog: https://github.com/bbatsov/rubocop/blob/master/CHANGELOG.md#0360-14012016