-
Notifications
You must be signed in to change notification settings - Fork 101
Refactor PhabricatorNotifier comment builder #48
Conversation
6d4310a
to
c2dcdf0
Compare
Instead of having one heaping class that's responsible for a bunch of business logic, breaking out the comment building and code coverage comparison into a self-contained class that is easier to test and understand. Future refactors will break down the Notifier even further, but this is one atomic piece of work that can go in. Additionally, fixed a bug in the TestUtils default coverage data, which was off by 100x for cobertura results (since cobertura the plugin returns them as floats from 0-1)
c2dcdf0
to
345ef8b
Compare
BTW, we're now finally >50% coverage (51%), so I'm considering adding the coveralls badge to remind me to keep going... |
* @return | ||
*/ | ||
public boolean hasCoverageAvailable() { | ||
if (currentCoverage == null) { |
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.
Can simplify this to:
return currentCoverage != null && currentCoverage.getCoverage(CoverageMetric.LINE) != null;
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 call. Done.
} | ||
} else { | ||
logger.info("uberalls", "no line coverage found, skipping..."); | ||
} | ||
|
||
if (build.getResult().isBetterOrEqualTo(Result.SUCCESS)) { |
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.
Can we just remove this entire thing and set the flag when the variable is instantiated?
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.
Awesome. Really appreciate your fine-toothed-comb reviews :D
👍 |
Refactor PhabricatorNotifier comment builder
Instead of having one heaping class that's responsible for a bunch of
business logic, breaking out the comment building and code coverage
comparison into a self-contained class that is easier to test and understand.
Future refactors will break down the Notifier even further, but this is
one atomic piece of work that can go in.
Additionally, fixed a bug in the TestUtils default coverage data, which
was off by 100x for cobertura results (since cobertura the plugin
returns them as floats from 0-1)