You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by "ottlinger (via GitHub)" <gi...@apache.org> on 2025/10/14 16:44:18 UTC

[PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

ottlinger opened a new pull request, #556:
URL: https://github.com/apache/creadur-rat/pull/556

   * main() checks if no arguments are provided at all and encourages to use --help instead
   * cleanup in integration tests (wrong package, order, unused imports)
   * test for RAT-500 to show no error is thrown


-- 
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: dev-unsubscribe@creadur.apache.org

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


Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by Claude Warren <cl...@xenei.com>.
If no arguments are provided there is no source directory to scan.  The
source directory must be provided or the option that explicitly specifies
the files to scan must be provided.

On Tue, Oct 14, 2025 at 6:00 PM ottlinger (via GitHub) <gi...@apache.org>
wrote:

>
> ottlinger commented on PR #556:
> URL:
> https://github.com/apache/creadur-rat/pull/556#issuecomment-3402826048
>
>    I wasn't able to properly construct an integration test as our test
> framework expects valid input parameters and files to scan, thus the test
> is merely a dummy test, that should break if any exceptions are thrown.
>
>
> --
> 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: dev-unsubscribe@creadur.apache.org
>
> For queries about this service, please contact Infrastructure at:
> users@infra.apache.org
>
>

-- 
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on code in PR #556:
URL: https://github.com/apache/creadur-rat/pull/556#discussion_r2453343605


##########
apache-rat-core/src/main/java/org/apache/rat/Report.java:
##########
@@ -40,6 +40,12 @@ public final class Report {
      * @throws Exception on error.
      */
     public static void main(final String[] args) throws Exception {
+        if (args == null || args.length == 0) {
+            DefaultLog.getInstance().info("Please use the \"--help\" option to see a " +
+                    "list of valid commands and options, as you did not provide any arguments.");
+            System.exit(0);
+        }
+
         DefaultLog.getInstance().info(new VersionInfo().toString());

Review Comment:
   @Claudenw Introducing System.exit(1) introduces problems as our testing framework does not properly handle JVM exits via ReportTest. If this is an issue we should open a separate ticket and maybe introduce https://github.com/tginsberg/junit5-system-exit. Feel free to file a new ticket with a reference to RAT-500 and your comment. Thanks



-- 
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: dev-unsubscribe@creadur.apache.org

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


Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by "Claudenw (via GitHub)" <gi...@apache.org>.
Claudenw commented on code in PR #556:
URL: https://github.com/apache/creadur-rat/pull/556#discussion_r2452663138


##########
apache-rat-core/src/main/java/org/apache/rat/Report.java:
##########
@@ -40,6 +40,12 @@ public final class Report {
      * @throws Exception on error.
      */
     public static void main(final String[] args) throws Exception {
+        if (args == null || args.length == 0) {
+            DefaultLog.getInstance().info("Please use the \"--help\" option to see a " +
+                    "list of valid commands and options, as you did not provide any arguments.");
+            System.exit(0);
+        }
+
         DefaultLog.getInstance().info(new VersionInfo().toString());

Review Comment:
   Move this line above your new check as this one puts out the version info.



##########
apache-rat-core/src/main/java/org/apache/rat/Report.java:
##########


Review Comment:
   I know this is not part of the same issue but,  the information has already been logged.  So lets replace this throw with a System.exit(1)



-- 
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: dev-unsubscribe@creadur.apache.org

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


Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on PR #556:
URL: https://github.com/apache/creadur-rat/pull/556#issuecomment-3402826048

   I wasn't able to properly construct an integration test as our test framework expects valid input parameters and files to scan, thus the test is merely a dummy test, that should break if any exceptions are thrown.


-- 
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: dev-unsubscribe@creadur.apache.org

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


Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on PR #556:
URL: https://github.com/apache/creadur-rat/pull/556#issuecomment-3431969319

   @Claudenw is my proposal to naiive or can it be merged? Thanks


-- 
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: dev-unsubscribe@creadur.apache.org

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


Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on code in PR #556:
URL: https://github.com/apache/creadur-rat/pull/556#discussion_r2453372998


##########
apache-rat-core/src/main/java/org/apache/rat/Report.java:
##########


Review Comment:
   @Claudenw Introducing System.exit(1) introduces problems as our testing framework does not properly handle JVM exits via ReportTest. If this is an issue we should open a separate ticket and maybe introduce https://github.com/tginsberg/junit5-system-exit. Feel free to file a new ticket with a reference to [RAT-500](https://issues.apache.org/jira/browse/RAT-500) and your comment. Thanks



-- 
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: dev-unsubscribe@creadur.apache.org

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


Re: [PR] RAT-500: Do not log exception of no arguments in CLI [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger merged PR #556:
URL: https://github.com/apache/creadur-rat/pull/556


-- 
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: dev-unsubscribe@creadur.apache.org

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