Skip to content
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 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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants