diff --git a/core/src/main/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbe.java b/core/src/main/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbe.java index 7ce290141..65f66b7ba 100644 --- a/core/src/main/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbe.java +++ b/core/src/main/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbe.java @@ -86,6 +86,11 @@ public String getDescription() { @Override public long getVersion() { - return 1; + return 2; + } + + @Override + protected boolean isSourceCodeRelated() { + return true; } } diff --git a/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoring.java b/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoring.java index bf1088f46..ca4dbc787 100644 --- a/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoring.java +++ b/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoring.java @@ -197,7 +197,7 @@ public int getWeight() { return 10; } }, - new ScoringComponent() { + new ScoringComponent() { // CodeOwnership @Override public String getDescription() { return "Plugin should have a valid CODEOWNERS file."; @@ -207,14 +207,41 @@ public String getDescription() { public ScoringComponentResult getScore(Plugin plugin, Map probeResults) { final ProbeResult result = probeResults.get(CodeOwnershipProbe.KEY); if (result == null || ProbeResult.Status.ERROR.equals(result.status())) { - return new ScoringComponentResult(0, getWeight(), List.of()); + return new ScoringComponentResult( + 0, + getWeight(), + List.of("Could not determine the plugins code ownership."), + List.of( + new Resolution( + "Please open a bug on plugin-health-scoring project.", + "https://github.com/jenkins-infra/plugin-health-scoring/issues/new/choose"))); } return switch (result.message()) { - case "CODEOWNERS file is valid." -> new ScoringComponentResult(100, getWeight(), List.of()); + case "CODEOWNERS file is valid." -> new ScoringComponentResult( + 100, getWeight(), List.of("Code Ownership definition found and is valid.")); case "CODEOWNERS file is not set correctly." -> new ScoringComponentResult( - 50, getWeight(), List.of()); - default -> new ScoringComponentResult(0, getWeight(), List.of()); + 50, + getWeight(), + List.of("Code Ownership is not set properly."), + List.of( + new Resolution( + "Learn about code owners", + "https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners"), + new Resolution( + "See OpenRewrite recipe to fix this.", + "https://docs.openrewrite.org/recipes/jenkins/github/addteamtocodeowners"))); + default -> new ScoringComponentResult( + 0, + getWeight(), + List.of("Repository would benefit from defining the code ownership."), + List.of( + new Resolution( + "Learn about code owners", + "https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners"), + new Resolution( + "See OpenRewrite recipe to fix this.", + "https://docs.openrewrite.org/recipes/jenkins/github/addteamtocodeowners"))); }; } @@ -244,6 +271,6 @@ public String description() { @Override public int version() { - return 4; + return 5; } } diff --git a/core/src/test/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbeTest.java b/core/src/test/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbeTest.java index 0ff7e4385..d534f028a 100644 --- a/core/src/test/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbeTest.java +++ b/core/src/test/java/io/jenkins/pluginhealth/scoring/probes/CodeOwnershipProbeTest.java @@ -44,6 +44,11 @@ CodeOwnershipProbe getSpy() { return spy(CodeOwnershipProbe.class); } + @Test + void shouldRequiresCodeModifications() { + assertThat(getSpy().isSourceCodeRelated()).isTrue(); + } + @Test void shouldDetectMissingCodeOwnershipFile() throws IOException { final Plugin plugin = mock(Plugin.class); diff --git a/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoringTest.java b/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoringTest.java index da3f23f74..2b9dd11dc 100644 --- a/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoringTest.java +++ b/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/PluginMaintenanceScoringTest.java @@ -63,439 +63,399 @@ static Stream probeResultsAndValue() { arguments( // All bad Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 0), arguments( // All bad with open dependabot pull request Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 0), arguments( // All good Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 100), arguments( // All good Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, + ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 100), arguments( // Only Jenkinsfile Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 50), arguments( // Jenkinsfile and dependabot but with open pull request Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 60), arguments( // Jenkinsfile and dependabot with no open pull request Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 70), arguments( // Jenkinsfile and renovate but with open pull request Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot not is configured.", 1), - RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot not is configured.", 1), + RenovateProbe.KEY, + ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 60), arguments( // Jenkinsfile and renovate with no open pull request Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot not is configured.", 1), - RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot not is configured.", 1), + RenovateProbe.KEY, + ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 70), arguments( // Jenkinsfile and CD Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 60), arguments( // Jenkinsfile and CD and dependabot but with open pull request Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 70), arguments( // Jenkinsfile and CD and dependabot but with no open pull request Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 80), arguments( // Dependabot only with no open pull requests Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 20), arguments( // Dependabot only with open pull requests Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 10), arguments( // Dependabot with no open pull request and CD Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 30), arguments( // Renovate only with no open pull requests Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, + ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 20), arguments( // Renovate only with open pull requests Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, + ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 10), arguments( // Renovate with no open pull request and CD Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, + ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 30), arguments( // CD only Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success( - CodeOwnershipProbe.KEY, - "No CODEOWNERS file found in plugin repository.", - 1)), + ProbeResult.success( + CodeOwnershipProbe.KEY, "No CODEOWNERS file found in plugin repository.", 1)), 10), arguments( // Codeownership only Map.of( JenkinsfileProbe.KEY, - ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), + ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 20), arguments( // Codeownership + Jenkinsfile Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, - "Could not find JEP-229 workflow definition.", - 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 70), arguments( // Codeownership + Jenkinsfile + CD Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 80), arguments( // Codeownership + Jenkinsfile + CD + Dependabot Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 90), arguments( // Codeownership + Jenkinsfile + CD Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), + JenkinsfileProbe.KEY, + ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, - ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, - ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, - ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), + ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), ContinuousDeliveryProbe.KEY, - ProbeResult.success( - ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), + ProbeResult.success( + ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), CodeOwnershipProbe.KEY, - ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), + ProbeResult.success(CodeOwnershipProbe.KEY, "CODEOWNERS file is valid.", 1)), 100)); } @@ -510,6 +470,9 @@ public void shouldScorePluginBasedOnProbeResultMatrix(Map d final ScoreResult result = scoring.apply(plugin); assertThat(result.componentsResults().size()).isEqualTo(4); + assertThat(result.componentsResults().stream() + .noneMatch(cr -> cr.reasons().isEmpty())) + .isTrue(); assertThat(result) .isNotNull() .usingRecursiveComparison()