-
Notifications
You must be signed in to change notification settings - Fork 20
Description
html5check.py exits with status code != 0 when operational errors occur. That's fine.
Validation Results Not Considered
Unfortunately, validation results aren't considered for the script's status code, hence the script always exists saying "SUCCESS". Even when the HTML document in question has validation errors.
Expected Behavior
As with other command line tools the script should exit with 0 only when everything was alright, including validation results.
For warnings the script may exit with 1, and with 2 when errors are present (with tidy as an example). It may be nice to allow for disabling reports of warnings and specific errors in this case.
Current Workarounds
One way I found to get this behavior is:
$ ! ./html5check.py example.html | grep "Error: "
However, the grep is a fragile test and isn't beautiful either. Also, for YAML files, e.g. Travis CI, a few tricks are needed to avoid syntax errors, e.g.:
script:
- bash -c '! python html5check.py example.html | grep "Error:\ "'
Ignoring specific errors/warnings goes like this: 😒 (not nice)
# check HTML, but ignore frameborder attribute error (needed for IE)
bash -c '! python html5check.py home/*.html | grep -v "Error:.*frameborder.*attribute.*iframe" | grep "Error:\ "'