From f27958c7246140bfabdef88a46cf8732f4bc39e9 Mon Sep 17 00:00:00 2001 From: Romain Deltour Date: Sat, 28 Dec 2024 22:39:09 +0100 Subject: [PATCH] fix: simplify `--failonwarnings` documentation The help text presented option `--failonwarnings` as if it also allowed values `--failonwarnings+` and `--failonwarnings-` to respectively enable and disable warning messages. The CLI implementation did not recognize these options. In addition, the single option `--failonwarnings` is sufficient, since the default behavior is to not return an error code when warnings are reported. This commit fixes the CLI help text, and tweak the implementation to remove traces of the legacy `--failonwarnings+` and `--failonwarnings-` options. Fixes #1575 --- src/main/java/com/adobe/epubcheck/tool/EpubChecker.java | 3 +-- .../resources/com/adobe/epubcheck/util/messages.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_da.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_de.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_es.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_fr.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_it.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_ja.properties | 2 +- .../com/adobe/epubcheck/util/messages_ko_KR.properties | 2 +- .../resources/com/adobe/epubcheck/util/messages_nl.properties | 2 +- .../com/adobe/epubcheck/util/messages_pt_BR.properties | 2 +- .../com/adobe/epubcheck/util/messages_zh_TW.properties | 2 +- src/test/resources/cli/cli.feature | 2 +- 13 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/adobe/epubcheck/tool/EpubChecker.java b/src/main/java/com/adobe/epubcheck/tool/EpubChecker.java index be0ebf7aa..f5e1d45c0 100644 --- a/src/main/java/com/adobe/epubcheck/tool/EpubChecker.java +++ b/src/main/java/com/adobe/epubcheck/tool/EpubChecker.java @@ -666,8 +666,7 @@ else if ((args.length > (i + 1)) && (args[i + 1].equalsIgnoreCase("-"))) outWriter.setQuiet(true); break; case "failonwarnings": - String fw = args[i].substring("--failonwarnings".length()); - failOnWarnings = (fw.compareTo("-") != 0); + failOnWarnings = true; break; case "r": case "redir": diff --git a/src/main/resources/com/adobe/epubcheck/util/messages.properties b/src/main/resources/com/adobe/epubcheck/util/messages.properties index 14e86762e..735c5e92e 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages.properties @@ -87,7 +87,7 @@ help_text = \ -o = same as --out\n\ -x = same as --xmp\n\ -j = same as --json\n\ - --failonwarnings[+|-] = By default, the tool returns a 1 if errors are found in the file or 0 if no errors\n\ + --failonwarnings = By default, the tool returns a 1 if errors are found in the file or 0 if no errors\n\ \ are found. Using --failonwarnings will cause the process to exit with a status of\n\ \ 1 if either warnings or errors are present and 0 only when there are no errors or warnings.\n\ -q, --quiet = no message on console, except errors, only in the output\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_da.properties b/src/main/resources/com/adobe/epubcheck/util/messages_da.properties index 367c6b367..b0a598468 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_da.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_da.properties @@ -80,7 +80,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = synonym for --out\n\ -x = synonym for --xmp\n\ -j = synonym for --json\n\ - --failonwarnings[+|-] = som standard afsluttes EPUBCheck med ExitCode 1 hvis der blev fundet fejl i filen, og med ExitCode 0 hvis der ikke blev fundet fejl.\n\ + --failonwarnings = som standard afsluttes EPUBCheck med ExitCode 1 hvis der blev fundet fejl i filen, og med ExitCode 0 hvis der ikke blev fundet fejl.\n\ \ Ved brug af --failonwarnings vil EPUBCheck blive klar til afslutning\n\ \ med ExitCode 1 når der er advarsler, og ExitCode 0 ved ingen fejl eller mangler.\n\ -q, --quiet = kun fejl udsendes på konsollen\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_de.properties b/src/main/resources/com/adobe/epubcheck/util/messages_de.properties index 843cadbf2..a4658e4b2 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_de.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_de.properties @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = Synonym zu --out\n\ -x = Synonym zu --xmp\n\ -j = Synonym zu --json\n\ - --failonwarnings[+|-] = Standardmäßig wird EPUBCheck mit ExitCode 1 beendet falls Fehler im EPUB gefunden wurden\n\ + --failonwarnings = Standardmäßig wird EPUBCheck mit ExitCode 1 beendet falls Fehler im EPUB gefunden wurden\n\ \ und mit ExitCode 0, falls keine Fehler gefunden wurden. Bei Nutzung von --failonwarnings\n\ \ wird EPUBCheck auch bereits bei Auftreten von Warnungen mit ExitCode 1 beendet.\n\ -q, --quiet = Nur Fehler werden auf der Konsole ausgegeben\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_es.properties b/src/main/resources/com/adobe/epubcheck/util/messages_es.properties index 903dc1c37..06d3317b9 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_es.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_es.properties @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = igual a --out\n\ -x = igual a --xmp\n\ -j = igual a --json\n\ - --failonwarnings[+|-] = Por defecto, la herramienta devuelve 1 si se encuentran errores en el archivo o 0 si no hay errores\n\ + --failonwarnings = Por defecto, la herramienta devuelve 1 si se encuentran errores en el archivo o 0 si no hay errores\n\ \ Utilizar --failonwarnings provoca la detención del proceso con un resultado\n\ \ de 1 si hay errores o advertencias y 0 cuando no los hay.\n\ -q, --quiet = no hay mensajes en la consola; excepto errores, solo en la salida\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_fr.properties b/src/main/resources/com/adobe/epubcheck/util/messages_fr.properties index d4a4b2c51..5d3b69fe3 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_fr.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_fr.properties @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = identique à --out\n\ -x = identique à --xmp\n\ -j = identique à --json\n\ - --failonwarnings[+|-] = Par défaut, cet outil renvoie 1 si des erreurs sont trouvées ou 0 si le fichier\n\ + --failonwarnings = Par défaut, cet outil renvoie 1 si des erreurs sont trouvées ou 0 si le fichier\n\ \ ne contient aucune erreur. En utilisant --failonwarnings, 1 sera renvoyé également\n\ \ si des warnings ou des erreurs sont présents, et 0 ne sera renvoyés que si le fichier\n\ \ ne contient ni erreurs ni warnings.\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_it.properties b/src/main/resources/com/adobe/epubcheck/util/messages_it.properties index c44c56bde..67264dbde 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_it.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_it.properties @@ -82,7 +82,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = sinonimo di --out\n\ -x = sinonimo di --xmp\n\ -j = sinonimo di --json\n\ - --failonwarnings[+|-] = di norma, ritorna 1 se sono rilevati errori,\n\ + --failonwarnings = di norma, ritorna 1 se sono rilevati errori,\n\ \ e 0 altrimenti.\n\ \ Specificando --failonwarnings, sarà ritornato\n\ \ 1 in presenza di errori o potenziali errori\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_ja.properties b/src/main/resources/com/adobe/epubcheck/util/messages_ja.properties index 4c28d05e0..bb7cf795d 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_ja.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_ja.properties @@ -81,7 +81,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = --out と同様\n\ -x = --xmp と同様\n\ -j = --json と同様\n\ - --failonwarnings[+|-] = デフォルトでは、終了ステータスコードとして、エラーが検出されれば1を、検出されなければ\n\ + --failonwarnings = デフォルトでは、終了ステータスコードとして、エラーが検出されれば1を、検出されなければ\n\ \ 0を返します. --failonwarnings オプションを指定すると、警告かエラーがあれば1を、警告もエラーもどちらも\n\ \ ない場合のみ0を返すようになります.\n\ -q, --quiet = エラー以外のメッセージをコンソールに出力しないようにします\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_ko_KR.properties b/src/main/resources/com/adobe/epubcheck/util/messages_ko_KR.properties index 666bf3d2c..b2f105c50 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_ko_KR.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_ko_KR.properties @@ -78,7 +78,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = --out과 같음\n\ -x = --xmp와 같음\n\ -j = --json과 같음\n\ - --failonwarnings[+|-] = 유효성 검사를 완료한 후 오류가 검출되면 1을 오류가 없으면 0을 반환합니다.\n\ + --failonwarnings = 유효성 검사를 완료한 후 오류가 검출되면 1을 오류가 없으면 0을 반환합니다.\n\ \ --failonwarnings 옵션을 지정하면 경고 또는 오류가있는 경우 1을 모두 없을 경우에만 0을 반환합니다.\n\ -q, --quiet = 오류를 제외하고 화면에 메시지를 출력하지 않습니다.\n\ -f, --fatal = 심각한 오류 메시지만 출력 파일에 표시합니다.\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_nl.properties b/src/main/resources/com/adobe/epubcheck/util/messages_nl.properties index 888e1a306..c71a9dd33 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_nl.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_nl.properties @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = gelijk aan --out\n\ -x = gelijk aan --xmp\n\ -j = gelijk aan --json\n\ - --failonwarnings[+|-] = standaard geeft het programma een waarde van 1 als er fouten worden gedetecteerd\n\ + --failonwarnings = standaard geeft het programma een waarde van 1 als er fouten worden gedetecteerd\n\ \ en een waarde van 0 als alles OK is.\n\ \ Gebruik --failonwarnings als u wilt dat er een waarde van 1 wordt teruggegeven als er fouten \n\ \ OF waarschuwingen worden ontdekt. \n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_pt_BR.properties b/src/main/resources/com/adobe/epubcheck/util/messages_pt_BR.properties index 1fd1ae3ce..e6415583b 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_pt_BR.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_pt_BR.properties @@ -81,7 +81,7 @@ help_text = EPUBCheck v%1$s\n\n\ -o = o mesmo que --out\n\ -x = o mesmo que --xmp\n\ -j = o mesmo que --json\n\ - --failonwarnings[+|-] = Por padrão, a ferramenta retorna 1 se erros forem encontrados no arquivo ou 0 se não forem\n\ + --failonwarnings = Por padrão, a ferramenta retorna 1 se erros forem encontrados no arquivo ou 0 se não forem\n\ \ encontrados erros. Usar --failonwarnings irá fazer com que o processo finalize com o status de\n\ \ 1 se houver tanto advertências como falhas presentes e 0 apenas quando não houver erros nem advertências.\n\ -q, --quiet = nenhuma mensagem no console, exceto erros, apenas na saída\n\ diff --git a/src/main/resources/com/adobe/epubcheck/util/messages_zh_TW.properties b/src/main/resources/com/adobe/epubcheck/util/messages_zh_TW.properties index f254e6951..84ef79b44 100644 --- a/src/main/resources/com/adobe/epubcheck/util/messages_zh_TW.properties +++ b/src/main/resources/com/adobe/epubcheck/util/messages_zh_TW.properties @@ -78,7 +78,7 @@ help_text = EPUB檢查器 %1$s版\n\n\ -o = 和 --out 相同\n\ -x = 和 --xmp 相同\n\ -j = 和 --json 相同\n\ - --failonwarnings[+|-] = 預設上,當發現錯誤時回報值為 1 或者沒有錯誤時回報值為 0。使用 --failonwarnings 將會使得處理程序終止,狀態為 1 並且有警告訊息或者錯誤需要顯示亦然,而只會在沒有錯誤與警告訊息時才會回傳 0。\n\ + --failonwarnings = 預設上,當發現錯誤時回報值為 1 或者沒有錯誤時回報值為 0。使用 --failonwarnings 將會使得處理程序終止,狀態為 1 並且有警告訊息或者錯誤需要顯示亦然,而只會在沒有錯誤與警告訊息時才會回傳 0。\n\ -q, --quiet = 除了錯誤以外不會在終端機上顯示訊息,但僅限於結果\n\ -f, --fatal = 結果僅包含致命錯誤\n\ -e, --error = 結果僅包含錯誤以及致命錯誤\n\ diff --git a/src/test/resources/cli/cli.feature b/src/test/resources/cli/cli.feature index 29c528e97..86b53ab29 100644 --- a/src/test/resources/cli/cli.feature +++ b/src/test/resources/cli/cli.feature @@ -56,7 +56,7 @@ Feature: EPUBCheck Command Line -o = same as --out -x = same as --xmp -j = same as --json - --failonwarnings[+|-] = By default, the tool returns a 1 if errors are found in the file or 0 if no errors + --failonwarnings = By default, the tool returns a 1 if errors are found in the file or 0 if no errors are found. Using --failonwarnings will cause the process to exit with a status of 1 if either warnings or errors are present and 0 only when there are no errors or warnings. -q, --quiet = no message on console, except errors, only in the output