Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Refactor PhabricatorNotifier comment builder #48

Merged
merged 3 commits into from
Jul 20, 2015
Merged

Conversation

ascandella
Copy link
Contributor

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)

@ascandella
Copy link
Contributor Author

@jjx

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)
@ascandella
Copy link
Contributor Author

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) {
Copy link
Contributor

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;

Copy link
Contributor Author

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)) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

@jjx
Copy link
Contributor

jjx commented Jul 20, 2015

👍

ascandella added a commit that referenced this pull request Jul 20, 2015
Refactor PhabricatorNotifier comment builder
@ascandella ascandella merged commit d61785c into master Jul 20, 2015
@ascandella ascandella deleted the refactor-commenter branch July 20, 2015 02:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants