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


##########
maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java:
##########
@@ -97,6 +97,12 @@
     @Parameter( property = "enforcer.failFast", defaultValue = "false" )
     private boolean failFast = false;
 
+    /**
+     * Set this to "true" to cause a failure if there are no rules to execute
+     */
+    @Parameter( property = "enforcer.failIfNoRules", defaultValue = "true" )

Review Comment:
   Pleas add `@since`
   
   Yes - I see that other parameters also has missing it ... we can fix for 
rest in separate PR
   
   It is used for  documentation: 
https://maven.apache.org/enforcer/maven-enforcer-plugin/enforce-mojo.html
   
   Maybe documentation - similar to other, eg:
   
   ```
   Flag to allow executions without rules.
   ```



##########
maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java:
##########
@@ -296,6 +296,14 @@ public void 
testLoggingOnEnforcerRuleExceptionWithoutMessage()
         Mockito.verify( logSpy ).warn( Mockito.matches( ".* failed with 
message:" + System.lineSeparator() + "null" ) );
     }
 
+    @Test
+    public void testFailIfNoTests()
+            throws MojoExecutionException {
+        setupBasics( false );
+        mojo.setFailIfNoRules( false );
+        mojo.execute();
+    }

Review Comment:
   please add some assertions, eg that `log.warn` was called only once with 
specific message and no more interactions on `log`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to