Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed output from validator.nu? #80

Closed
153957 opened this issue Mar 27, 2015 · 4 comments
Closed

Changed output from validator.nu? #80

153957 opened this issue Mar 27, 2015 · 4 comments

Comments

@153957
Copy link

153957 commented Mar 27, 2015

I use the html5check script, which uses validator.nu, to validate the code for several of my projects.
The last couple of days the test script stopped working. Has the output from validator.nu changed in the last couple of days? I have also reported this issue (mozilla/html5-lint#15) in the repo of the html5check script, however that script has not changed, so the 'cause' of the issues is probably a change in validator.nu .

@sideshowbarker
Copy link
Contributor

Are you using the -g option? Trying the script myself I find that when I use -g option it does't work. I'm not sure why at this point. I didn't write the script and it's not really maintained, but I'll try to make some time to look into over the next couple days. In the mean time, maybe @hsivonen might be able to say.

Otherwise, the version of the script at https://github.com/validator/validator/blob/master/resources/examples/html5check.py appears to still be working as expected when I use it without specifying any other options. Are you using that version? Without any options specified?

The last couple of days the test script stopped working.

If you're not using the -g option, can you be more specific? Exactly in what way has the script stopped working? e.g., it doesn't run at all, or it runs but you get some error message? (If so, what error message.) Or it runs without errors but the output isn't what you expect?

Has the output from validator.nu changed in the last couple of days?

Yes, I made some changes to the backend recently that have some effect on the metadata of the error messages that get emitted; in particular, the messages now emit a range identifier for the location of the error in the document source, rather than a single position identifier. I wouldn't think that would affect the behavior of this script—because I'd assume the script is just passing on the messages as-is—but maybe it's trying to do some post-processing of the messages (I have no idea because I haven't looked in detail at the script source yet to see).

@153957
Copy link
Author

153957 commented Mar 28, 2015

I specified the errors in more detail in this issue at html5-lint: mozilla/html5-lint#15
Yes, I am using the -g (and -eh) option.

Apperantly the response variable in the script is no longer automatically an interator over the lines.

Traceback (most recent call last):
  File "./html5check.py", line 232, in <module>
    for line in response:
TypeError: iteration over non-sequence

I was able to get the script working again with a small modification to that for-loop causing the error:

for line in response.read().split('\n'):
  if line:
      sys.stdout.write(quotedName)
      sys.stdout.write(line + '\n')

I use the -g option to get the output as separate lines, because I want to filter the output.
My usage of the script (on Travis to check my websites):

CHECK=$(for file in *.html; do python ../html5check.py -geh $file; done;)
if [[ ! -z $(echo "$CHECK" | grep -vE 'index_|iframe') ]]; then echo "$CHECK"; exit 1; fi;

The script itself does not seem to do any post processing to the actual content of the response.
The latest version of the script from html5-lint also works without the -g option.

@sideshowbarker
Copy link
Contributor

OK it sounds like you got the fix you need. So maybe you could open a PR against the https://github.com/mozilla/html5-lint/blob/master/html5check.py and after that I can backport it to the https://github.com/validator/validator/blob/master/resources/examples/html5check.py upstream version.

Or if you believe I've regressed the backend in some way that I should fix, lemme know.

@153957
Copy link
Author

153957 commented Mar 30, 2015

Fixed in mozilla/html5-lint#16

tripu pushed a commit to tripu/validator that referenced this issue Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants