I seem to have found an edge case where if the --root option is set to a folder that doesn't exist then the default help text is displayed for vnujar.
Example:
> html5validator --root INVALID --log DEBUG
INFO:html5validator.cli:Files to validate:
INFO:html5validator.cli:Number of files: 0
DEBUG:html5validator.validator:['java', '-jar', '/home/j/.local/lib/python3.6/site-packages/vnujar/vnu.jar', '--errors-only', '--stdout', '--asciiquotes']
DEBUG:html5validator.validator:['Error: No documents specified.', 'Usage:', ' vnu-runtime-image/bin/vnu OPTIONS FILES (Linux or macOS)', ' vnu-runtime-image\\bin\\vnu.bat OPTIONS FILES (Windows)', ' java -jar ~/vnu.jar OPTIONS FILES (any system with Java8+ installed)', '...where FILES are the documents to check, and OPTIONS are zero or more of:', ' --errors-only --Werror --exit-zero-always --stdout --asciiquotes', ' --user-agent\xa0USER_AGENT --no-langdetect --no-stream --filterfile\xa0FILENAME', ' --filterpattern\xa0PATTERN --css --skip-non-css --also-check-css --svg', ' --skip-non-svg --also-check-svg --html --skip-non-html', ' --format\xa0gnu|xml|json|text --help --verbose --version', 'For detailed usage information, try the "--help" option or see:', ' http://validator.github.io/', 'To read from stdin, use "-" as the filename, like this: "java -jar vnu.jar - ".', 'To run the checker as a standalone Web-based service, open a new terminal', 'window and invoke the checker like this', ' java -cp vnu.jar nu.validator.servlet.Main 8888', ' vnu-runtime-image/bin/java nu.validator.servlet.Main 8888', ' vnu-runtime-image\\bin\\java -cp vnu.jar nu.validator.servlet.Main 8888', '...then open http://127.0.0.1:8888 in a browser.', 'After that, to check documents locally using the packaged HTTP client, do this:', ' java -cp vnu.jar nu.validator.client.HttpClient FILES', ' vnu-runtime-image/bin/java nu.validator.client.HttpClient FILES', ' vnu-runtime-image\\bin\\java nu.validator.client.HttpClient FILES']
Error: No documents specified.
Usage:
vnu-runtime-image/bin/vnu OPTIONS FILES (Linux or macOS)
vnu-runtime-image\bin\vnu.bat OPTIONS FILES (Windows)
java -jar ~/vnu.jar OPTIONS FILES (any system with Java8+ installed)
...where FILES are the documents to check, and OPTIONS are zero or more of:
--errors-only --Werror --exit-zero-always --stdout --asciiquotes
--user-agent USER_AGENT --no-langdetect --no-stream --filterfile FILENAME
--filterpattern PATTERN --css --skip-non-css --also-check-css --svg
--skip-non-svg --also-check-svg --html --skip-non-html
--format gnu|xml|json|text --help --verbose --version
For detailed usage information, try the "--help" option or see:
http://validator.github.io/
To read from stdin, use "-" as the filename, like this: "java -jar vnu.jar - ".
To run the checker as a standalone Web-based service, open a new terminal
window and invoke the checker like this
java -cp vnu.jar nu.validator.servlet.Main 8888
vnu-runtime-image/bin/java nu.validator.servlet.Main 8888
vnu-runtime-image\bin\java -cp vnu.jar nu.validator.servlet.Main 8888
...then open http://127.0.0.1:8888 in a browser.
After that, to check documents locally using the packaged HTTP client, do this:
java -cp vnu.jar nu.validator.client.HttpClient FILES
vnu-runtime-image/bin/java nu.validator.client.HttpClient FILES
vnu-runtime-image\bin\java nu.validator.client.HttpClient FILES
> echo $?
24
I'm not sure the best way to solve this and if we even should (See edit).
My best way would be to check if root exists?
Edit: I do believe that this should be fixed as it is being detected that there are no files to validate but it still continues to run.
I seem to have found an edge case where if the
--root
option is set to a folder that doesn't exist then the default help text is displayed forvnujar
.Example:
I'm not sure the best way to solve this
and if we even should(See edit).My best way would be to check if
root
exists?Edit: I do believe that this should be fixed as it is being detected that there are no files to validate but it still continues to run.