You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/12/27 22:55:19 UTC

[GitHub] [maven-enforcer] slawekjaranowski commented on a diff in pull request #205: [MENFORCER-431] Introduce property to skip specific rules

slawekjaranowski commented on code in PR #205:
URL: https://github.com/apache/maven-enforcer/pull/205#discussion_r1057954678


##########
maven-enforcer-plugin/src/it/projects/cli-skip-rules/invoker.properties:
##########
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = validate -Denforcer.skipRules=alwaysFail

Review Comment:
   - please add verify script yo be sure that rule `alwaysPass` was executed



##########
maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java:
##########
@@ -115,6 +120,14 @@ public class EnforceMojo extends AbstractMojo {
     @Parameter(required = false, property = "rules")
     private String[] commandLineRules;
 
+    /**
+     * Array of Strings that matches the EnforcerRules to skip.
+     *
+     * @since 3.2.0
+     */
+    @Parameter(required = false, property = "enforcer.skipRules")
+    private String[] commandLineRulesToSkip;

Review Comment:
   field name determinate configuration item for plugin, but can be changed by `@Parameter(name=...)`



##########
maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java:
##########
@@ -134,9 +147,7 @@ public void execute() throws MojoExecutionException {
         Log log = this.getLog();
 
         PluginParameterExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(session, mojoExecution);
-        if (commandLineRules != null && commandLineRules.length > 0) {
-            this.rules = createRulesFromCommandLineOptions();
-        }
+        this.rules = determineRulesToExecute();

Review Comment:
   technically plugin doesn't need getters and setters - I see that `getRules` is not used



##########
maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java:
##########
@@ -115,6 +120,14 @@ public class EnforceMojo extends AbstractMojo {
     @Parameter(required = false, property = "rules")
     private String[] commandLineRules;

Review Comment:
   deprecated will be good idea - separate issue and PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org