Skip to content

Commit

Permalink
fix: simplify --failonwarnings documentation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rdeltour committed Dec 28, 2024
1 parent 26fd614 commit f27958c
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/adobe/epubcheck/tool/EpubChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ help_text = \
-o <file> = same as --out\n\
-x <file> = same as --xmp\n\
-j <file> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = synonym for --out\n\
-x <file> = synonym for --xmp\n\
-j <file> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <datei> = Synonym zu --out\n\
-x <datei> = Synonym zu --xmp\n\
-j <datei> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = igual a --out\n\
-x <file> = igual a --xmp\n\
-j <file> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = identique à --out\n\
-x <file> = identique à --xmp\n\
-j <file> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = sinonimo di --out\n\
-x <file> = sinonimo di --xmp\n\
-j <file> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = --out と同様\n\
-x <file> = --xmp と同様\n\
-j <file> = --json と同様\n\
--failonwarnings[+|-] = デフォルトでは、終了ステータスコードとして、エラーが検出されれば1を、検出されなければ\n\
--failonwarnings = デフォルトでは、終了ステータスコードとして、エラーが検出されれば1を、検出されなければ\n\
\ 0を返します. --failonwarnings オプションを指定すると、警告かエラーがあれば1を、警告もエラーもどちらも\n\
\ ない場合のみ0を返すようになります.\n\
-q, --quiet = エラー以外のメッセージをコンソールに出力しないようにします\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = --out과 같음\n\
-x <file> = --xmp와 같음\n\
-j <file> = --json과 같음\n\
--failonwarnings[+|-] = 유효성 검사를 완료한 후 오류가 검출되면 1을 오류가 없으면 0을 반환합니다.\n\
--failonwarnings = 유효성 검사를 완료한 후 오류가 검출되면 1을 오류가 없으면 0을 반환합니다.\n\
\ --failonwarnings 옵션을 지정하면 경고 또는 오류가있는 경우 1을 모두 없을 경우에만 0을 반환합니다.\n\
-q, --quiet = 오류를 제외하고 화면에 메시지를 출력하지 않습니다.\n\
-f, --fatal = 심각한 오류 메시지만 출력 파일에 표시합니다.\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <file> = gelijk aan --out\n\
-x <file> = gelijk aan --xmp\n\
-j <file> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ help_text = EPUBCheck v%1$s\n\n\
-o <arquivo> = o mesmo que --out\n\
-x <arquivo> = o mesmo que --xmp\n\
-j <arquivo> = 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\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ help_text = EPUB檢查器 %1$s版\n\n\
-o <file> = 和 --out 相同\n\
-x <file> = 和 --xmp 相同\n\
-j <file> = 和 --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\
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/cli/cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Feature: EPUBCheck Command Line
-o <file> = same as --out
-x <file> = same as --xmp
-j <file> = 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
Expand Down

0 comments on commit f27958c

Please sign in to comment.