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

[MNG-7823] Improve plugin validation level parsing #1182

Merged
merged 4 commits into from
Jun 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,22 @@ private enum ValidationReportLevel {
public void onEvent(Object event) {
if (event instanceof ExecutionEvent) {
ExecutionEvent executionEvent = (ExecutionEvent) event;
if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
if (executionEvent.getType() == ExecutionEvent.Type.SessionStarted) {
RepositorySystemSession repositorySystemSession =
executionEvent.getSession().getRepositorySession();
validationReportLevel(repositorySystemSession); // this will parse and store it in session.data
} else if (executionEvent.getType() == ExecutionEvent.Type.SessionEnded) {
reportSessionCollectedValidationIssues(executionEvent.getSession());
}
}
}

private ValidationReportLevel validationReportLevel(RepositorySystemSession session) {
return (ValidationReportLevel) session.getData()
.computeIfAbsent(ValidationReportLevel.class, () -> parseValidationReportLevel(session));
}

private ValidationReportLevel parseValidationReportLevel(RepositorySystemSession session) {
String level = ConfigUtils.getString(session, null, MAVEN_PLUGIN_VALIDATION_KEY);
if (level == null || level.isEmpty()) {
return DEFAULT_VALIDATION_LEVEL;
Expand Down