Skip to content

Commit

Permalink
Simplify environment variable reading.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed May 10, 2024
1 parent 7c40d84 commit 00b9b1a
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class GitHubAnnotationsBuilder extends CommentBuilder {
this.log = log;

maxWarningComments = getIntegerEnvironment("MAX_WARNING_ANNOTATIONS");
log.logInfo(">>>> MAX_WARNING_ANNOTATIONS: %d", getMaxWarningComments());

maxCoverageComments = getIntegerEnvironment("MAX_COVERAGE_ANNOTATIONS");
log.logInfo(">>>> MAX_COVERAGE_ANNOTATIONS: %d", getMaxCoverageComments());
}

@Override
Expand All @@ -48,6 +45,12 @@ protected int getMaxCoverageComments() {
}

private int getIntegerEnvironment(final String key) {
var value = getIntegerEnvironmentWithDefault(key);
log.logInfo(">>>> %s: %d", key, value);
return value;
}

private int getIntegerEnvironmentWithDefault(final String key) {
var value = getEnv(key);
try {
return Integer.parseInt(value);
Expand Down

0 comments on commit 00b9b1a

Please sign in to comment.