-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
142 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,42 @@ | ||
package edu.hm.hafner.analysis; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Resolves module names by reading and mapping module definitions (build.xml, pom.xml, or Manifest.mf files). | ||
* | ||
* @author Ullrich Hafner | ||
*/ | ||
public class ModuleResolver { | ||
private final ModuleDetectorRunner runner; | ||
|
||
/** | ||
* Creates a new instance of {@link ModuleResolver}. | ||
* | ||
* @param runner the module runner to use | ||
*/ | ||
public ModuleResolver(final ModuleDetectorRunner runner) { | ||
this.runner = runner; | ||
} | ||
|
||
/** | ||
* Resolves absolute paths of the affected files of the specified set of issues. | ||
* Resolves the absolute paths of all affected files referenced by the specified report. | ||
* | ||
* @param report | ||
* the issues to resolve the paths | ||
* @param detector | ||
* the module detector to use | ||
* the issues to resolve the paths for | ||
*/ | ||
public void run(final Report report, final ModuleDetector detector) { | ||
public void run(final Report report) { | ||
List<Issue> issuesWithoutModule = report.stream() | ||
.filter(issue -> !issue.hasModuleName()) | ||
.collect(Collectors.toList()); | ||
.toList(); | ||
|
||
if (issuesWithoutModule.isEmpty()) { | ||
report.logInfo("-> all issues already have a valid module name"); | ||
|
||
return; | ||
} | ||
|
||
issuesWithoutModule.forEach(issue -> issue.setModuleName(detector.guessModuleName(issue.getAbsolutePath()))); | ||
issuesWithoutModule.forEach(issue -> issue.setModuleName(runner.guessModuleName(issue.getAbsolutePath()))); | ||
report.logInfo("-> resolved module names for %d issues", issuesWithoutModule.size()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.