Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Mar 2, 2021
1 parent abee728 commit 87b5f19
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions src/main/java/edu/hm/hafner/grading/AutoGradingAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -11,7 +12,6 @@
import org.apache.commons.lang3.StringUtils;

import edu.hm.hafner.analysis.FileReaderFactory;
import edu.hm.hafner.analysis.IssueParser;
import edu.hm.hafner.analysis.Report;
import edu.hm.hafner.analysis.Report.IssueFilterBuilder;
import edu.hm.hafner.analysis.Severity;
Expand Down Expand Up @@ -107,14 +107,6 @@ void run() {
score.addAnalysisScores(new AnalysisReportSupplier(analysisScores));
System.out.println("==================================================================");

if (Files.isReadable(Paths.get(JACOCO_RESULTS))) {
JacocoReport coverageReport = new JacocoParser().parse(read(JACOCO_RESULTS));
score.addCoverageScores(new CoverageReportSupplier(coverageReport));
}
else {
System.out.println("No JaCoCo coverage result files found!");
}

GradingReport results = new GradingReport();
GitHubPullRequestWriter pullRequestWriter = new GitHubPullRequestWriter();

Expand All @@ -133,16 +125,6 @@ private String createAffectedFiles(final GradingConfiguration configuration) {
return StringUtils.EMPTY;
}

private Report parse(final GradingConfiguration configuration, final ParserDescriptor descriptor) {
return filterAnalysisReport(descriptor.createParser().parse(read(descriptor.getPattern())),
configuration.getAnalysisPattern());
}

private Report parse(final GradingConfiguration configuration,
final IssueParser parser, final String filePattern) {
return filterAnalysisReport(parser.parse(read(filePattern)), configuration.getAnalysisPattern());
}

private Report filterAnalysisReport(final Report checkStyleReport, final String analysisPattern) {
IssueFilterBuilder builder = new IssueFilterBuilder();
builder.setIncludeFileNameFilter(analysisPattern);
Expand All @@ -167,10 +149,6 @@ private String getChecksName() {
return StringUtils.defaultIfBlank(System.getenv("CHECKS_NAME"), "Autograding results");
}

private String getRepository() {
return StringUtils.defaultIfBlank(System.getenv("GITHUB_REPOSITORY"), "Autograding results");
}

private String getConfiguration() {
String configuration = System.getenv("CONFIG");
if (StringUtils.isBlank(configuration)) {
Expand All @@ -195,7 +173,4 @@ private String readDefaultConfiguration() {
}
}

private static FileReaderFactory read(final String s) {
return new FileReaderFactory(Paths.get(s));
}
}

0 comments on commit 87b5f19

Please sign in to comment.