diff --git a/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/DocumentationScoring.java b/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/DocumentationScoring.java new file mode 100644 index 000000000..12d1ea874 --- /dev/null +++ b/core/src/main/java/io/jenkins/pluginhealth/scoring/scores/DocumentationScoring.java @@ -0,0 +1,117 @@ +/* + * MIT License + * + * Copyright (c) 2024 Jenkins Infra + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package io.jenkins.pluginhealth.scoring.scores; + +import java.util.List; +import java.util.Map; + +import io.jenkins.pluginhealth.scoring.model.Plugin; +import io.jenkins.pluginhealth.scoring.model.ProbeResult; +import io.jenkins.pluginhealth.scoring.model.ScoringComponentResult; +import io.jenkins.pluginhealth.scoring.probes.ContributingGuidelinesProbe; +import io.jenkins.pluginhealth.scoring.probes.DocumentationMigrationProbe; + +import org.springframework.stereotype.Component; + +@Component +public class DocumentationScoring extends Scoring { + public static final String KEY = "documentation"; + + @Override + public String key() { + return KEY; + } + + @Override + public float weight() { + return .5f; + } + + @Override + public String description() { + return "Validates that the plugin has a specific contributing guide and a documentation."; + } + + @Override + public List getComponents() { + return List.of(new ScoringComponent() { + @Override + public String getDescription() { + return "The plugin has a specific contributing guide."; + } + + @Override + public ScoringComponentResult getScore(Plugin plugin, Map probeResults) { + ProbeResult probeResult = probeResults.get(ContributingGuidelinesProbe.KEY); + if (probeResult != null && "Contributing guidelines found.".equals(probeResult.message())) { + return new ScoringComponentResult(100, getWeight(), List.of("Plugin has a contributing guide.")); + } + return new ScoringComponentResult(0, getWeight(), List.of("The plugin relies on the global contributing guide.")); + } + + @Override + public int getWeight() { + return 2; + } + }, + new ScoringComponent() { + @Override + public String getDescription() { + return "Plugin documentation should be migrated from the wiki."; + } + + @Override + public ScoringComponentResult getScore(Plugin $, Map probeResults) { + final ProbeResult probeResult = probeResults.get(DocumentationMigrationProbe.KEY); + if (probeResult == null || ProbeResult.Status.ERROR.equals(probeResult.status())) { + return new ScoringComponentResult(0, getWeight(), List.of("Cannot confirm or not the documentation migration.")); + } + return switch (probeResult.message()) { + case "Documentation is located in the plugin repository." -> + new ScoringComponentResult(100, getWeight(), List.of("Documentation is in plugin repository.")); + case "Documentation is not located in the plugin repository." -> + new ScoringComponentResult( + 0, + getWeight(), + List.of("Documentation should be migrated in plugin repository."), + List.of("https://www.jenkins.io/doc/developer/tutorial-improve/migrate-documentation-to-github/") + ); + default -> + new ScoringComponentResult(0, getWeight(), List.of("Cannot confirm or not the documentation migration.", probeResult.message())); + }; + } + + @Override + public int getWeight() { + return 8; + } + }); + } + + @Override + public int version() { + return 1; + } +} 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 73f6c9068..1ea632a1b 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 @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2023 Jenkins Infra + * Copyright (c) 2023-2024 Jenkins Infra * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,7 +33,6 @@ import io.jenkins.pluginhealth.scoring.probes.ContinuousDeliveryProbe; import io.jenkins.pluginhealth.scoring.probes.DependabotProbe; import io.jenkins.pluginhealth.scoring.probes.DependabotPullRequestProbe; -import io.jenkins.pluginhealth.scoring.probes.DocumentationMigrationProbe; import io.jenkins.pluginhealth.scoring.probes.JenkinsfileProbe; import io.jenkins.pluginhealth.scoring.probes.RenovateProbe; @@ -79,38 +78,6 @@ public int getWeight() { return 65; } }, - new ScoringComponent() { // Documentation migration done - @Override - public String getDescription() { - return "Plugin documentation should be migrated from the wiki."; - } - - @Override - public ScoringComponentResult getScore(Plugin $, Map probeResults) { - final ProbeResult probeResult = probeResults.get(DocumentationMigrationProbe.KEY); - if (probeResult == null || ProbeResult.Status.ERROR.equals(probeResult.status())) { - return new ScoringComponentResult(0, getWeight(), List.of("Cannot confirm or not the documentation migration.")); - } - return switch (probeResult.message()) { - case "Documentation is located in the plugin repository." -> - new ScoringComponentResult(100, getWeight(), List.of("Documentation is in plugin repository.")); - case "Documentation is not located in the plugin repository." -> - new ScoringComponentResult( - 0, - getWeight(), - List.of("Documentation should be migrated in plugin repository."), - List.of("https://www.jenkins.io/doc/developer/tutorial-improve/migrate-documentation-to-github/") - ); - default -> - new ScoringComponentResult(0, getWeight(), List.of("Cannot confirm or not the documentation migration.", probeResult.message())); - }; - } - - @Override - public int getWeight() { - return 15; - } - }, new ScoringComponent() { // Dependabot and not dependency pull requests @Override public String getDescription() { @@ -221,6 +188,6 @@ public String description() { @Override public int version() { - return 2; + return 3; } } diff --git a/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/DocumentationScoringTest.java b/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/DocumentationScoringTest.java new file mode 100644 index 000000000..b39c07e97 --- /dev/null +++ b/core/src/test/java/io/jenkins/pluginhealth/scoring/scores/DocumentationScoringTest.java @@ -0,0 +1,99 @@ +/* + * MIT License + * + * Copyright (c) 2024 Jenkins Infra + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package io.jenkins.pluginhealth.scoring.scores; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import java.util.Map; +import java.util.Set; + +import io.jenkins.pluginhealth.scoring.model.Plugin; +import io.jenkins.pluginhealth.scoring.model.ProbeResult; +import io.jenkins.pluginhealth.scoring.model.ScoreResult; +import io.jenkins.pluginhealth.scoring.probes.ContributingGuidelinesProbe; +import io.jenkins.pluginhealth.scoring.probes.DocumentationMigrationProbe; + +import org.junit.jupiter.api.Test; + +class DocumentationScoringTest extends AbstractScoringTest { + @Override + DocumentationScoring getSpy() { + return spy(DocumentationScoring.class); + } + + @Test + void shouldScoreOneHundredWithMigratedDocumentationAndContributingGuide() { + final Plugin plugin = mock(Plugin.class); + final DocumentationScoring scoring = getSpy(); + + when(plugin.getDetails()).thenReturn(Map.of( + DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1), + ContributingGuidelinesProbe.KEY, ProbeResult.success(ContributingGuidelinesProbe.KEY, "Contributing guidelines found.", 1) + )); + + ScoreResult result = scoring.apply(plugin); + assertThat(result) + .isNotNull() + .usingRecursiveComparison().comparingOnlyFields("key", "value") + .isEqualTo(new ScoreResult(DocumentationScoring.KEY, 100, .5f, Set.of(), 1)); + } + + @Test + void shouldScoreEightyWithMigratedDocumentationOnly() { + final Plugin plugin = mock(Plugin.class); + final DocumentationScoring scoring = getSpy(); + + when(plugin.getDetails()).thenReturn(Map.of( + DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1), + ContributingGuidelinesProbe.KEY, ProbeResult.success(ContributingGuidelinesProbe.KEY, "No contributing guidelines found.", 1) + )); + + ScoreResult result = scoring.apply(plugin); + assertThat(result) + .isNotNull() + .usingRecursiveComparison().comparingOnlyFields("key", "value") + .isEqualTo(new ScoreResult(DocumentationScoring.KEY, 80, .5f, Set.of(), 1)); + } + + @Test + void shouldScoreZeroWithMigratedDocumentationOnly() { + final Plugin plugin = mock(Plugin.class); + final DocumentationScoring scoring = getSpy(); + + when(plugin.getDetails()).thenReturn(Map.of( + DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1), + ContributingGuidelinesProbe.KEY, ProbeResult.success(ContributingGuidelinesProbe.KEY, "No contributing guidelines found.", 1) + )); + + ScoreResult result = scoring.apply(plugin); + assertThat(result) + .isNotNull() + .usingRecursiveComparison().comparingOnlyFields("key", "value") + .isEqualTo(new ScoreResult(DocumentationScoring.KEY, 0, .5f, Set.of(), 1)); + } +} 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 d2b9dace7..6f13c3103 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 @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2023 Jenkins Infra + * Copyright (c) 2023-2024 Jenkins Infra * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,7 +40,6 @@ import io.jenkins.pluginhealth.scoring.probes.ContinuousDeliveryProbe; import io.jenkins.pluginhealth.scoring.probes.DependabotProbe; import io.jenkins.pluginhealth.scoring.probes.DependabotPullRequestProbe; -import io.jenkins.pluginhealth.scoring.probes.DocumentationMigrationProbe; import io.jenkins.pluginhealth.scoring.probes.JenkinsfileProbe; import io.jenkins.pluginhealth.scoring.probes.RenovateProbe; @@ -66,20 +65,20 @@ static Stream probeResultsAndValue() { arguments(// All bad Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "dependabot is not configured.", 1), + DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), 0 ), arguments(// All bad with open dependabot pull request Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "dependabot is not configured.", 1), + DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), 0 ), @@ -89,8 +88,7 @@ static Stream probeResultsAndValue() { DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), 100 ), @@ -100,8 +98,7 @@ static Stream probeResultsAndValue() { DependabotProbe.KEY, 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), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), 100 ), @@ -109,145 +106,139 @@ static Stream probeResultsAndValue() { Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 65 + 76 ), arguments(// Jenkinsfile and dependabot but with open pull request Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 73 + 85 ), arguments(// Jenkinsfile and dependabot with no open pull request Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 80 + 94 ), - arguments(// Jenkinsfile and CD + arguments(// Jenkinsfile and renovate but with open pull request Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + DependabotProbe.KEY, 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), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 70 + 85 ), - arguments(// Jenkinsfile and documentation + arguments(// Jenkinsfile and renovate with no open pull request Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + DependabotProbe.KEY, 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), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 80 + 94 ), - arguments(// Jenkinsfile and CD and dependabot but with open pull request + arguments(// Jenkinsfile and CD Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), - DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), - 78 + 82 ), - arguments(// Jenkinsfile and CD and dependabot with no open pull request + arguments(// Jenkinsfile and CD and dependabot but with open pull request Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), - DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), - 85 + 91 ), arguments(// Dependabot only with no open pull requests Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 15 + 18 ), - arguments(// CD only + arguments(// Dependabot only with open pull requests Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 5 + 9 ), arguments(// Dependabot with no open pull request and CD Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "0", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is not located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), - 20 + 24 ), - arguments(// Dependabot with no open pull request and documentation + arguments(// Renovate only with no open pull requests Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + DependabotProbe.KEY, 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), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 30 + 18 ), - arguments(// Documentation migration only + arguments(// Renovate only with open pull requests Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) - ), - 15 - ), - arguments(// Documentation migration and Dependabot but with open pull requests - Map.of( - JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is configured.", 1), DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1) ), - 23 + 9 ), - arguments(// Documentation migration and Dependabot with no open pull requests + arguments(// Renovate with no open pull request and CD Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), - DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is configured.", 1), + DependabotProbe.KEY, 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), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "Could not find JEP-229 workflow definition.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), - 30 + 24 ), - arguments(// Documentation migration and CD + arguments(// CD only Map.of( JenkinsfileProbe.KEY, ProbeResult.success(JenkinsfileProbe.KEY, "No Jenkinsfile found", 1), DependabotProbe.KEY, ProbeResult.success(DependabotProbe.KEY, "Dependabot is not configured.", 1), - ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1), - DocumentationMigrationProbe.KEY, ProbeResult.success(DocumentationMigrationProbe.KEY, "Documentation is located in the plugin repository.", 1) + RenovateProbe.KEY, ProbeResult.success(RenovateProbe.KEY, "Renovate is not configured.", 1), + DependabotPullRequestProbe.KEY, ProbeResult.success(DependabotPullRequestProbe.KEY, "1", 1), + ContinuousDeliveryProbe.KEY, ProbeResult.success(ContinuousDeliveryProbe.KEY, "JEP-229 workflow definition found.", 1) ), - 20 + 6 ) ); } @@ -262,6 +253,7 @@ public void shouldScorePluginBasedOnProbeResultMatrix(Map d final ScoreResult result = scoring.apply(plugin); + assertThat(result.componentsResults().size()).isEqualTo(3); assertThat(result) .isNotNull() .usingRecursiveComparison()