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

Fix w3c_validator.rb validation script #28022

Merged
merged 1 commit into from Feb 23, 2017

Conversation

Projects
None yet
6 participants
@spk
Contributor

spk commented Feb 15, 2017

Summary

w3c_validator.rb currently failing with:

/usr/bin/ruby2.3 w3c_validator.rb

Could not validate ./output/credits.html because of 302 "Found"
Could not validate ./output/3_2_release_notes.html because of 302 "Found"
Could not validate ./output/rails_application_templates.html because of 302 "Found"
Could not validate ./output/active_record_basics.html because of 302 "Found"

Other Information

PR submitted to the gem w3c-validators/w3c_validators#33

@rails-bot

This comment has been minimized.

rails-bot commented Feb 15, 2017

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @sgrif (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Feb 15, 2017

Is this changing the validation to be done at the website already published? And have you tried to generate the guides before trying to run the validator? I believe that error would not happen if you do that.

@spk

This comment has been minimized.

Contributor

spk commented Feb 15, 2017

Yes I've generated it with rake guides:generate ALL=1 RAILS_VERSION=v5.1.0; It is generated correctly but all validation is skipped due to this rescue

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Feb 15, 2017

Why not try to fix it instead of changing the implementation to hit the website that is too late for the validation?

@spk

This comment has been minimized.

Contributor

spk commented Feb 15, 2017

It does not hit the website, its is local template validation. I did search for a fix but I will look it up

@spk spk force-pushed the spk:guides-validation branch Feb 15, 2017

@spk spk changed the title from Use validate-website gem instead of w3c_validators to Fix w3c_validator.rb validation script Feb 15, 2017

@maclover7 maclover7 added the docs label Feb 15, 2017

@spk

This comment has been minimized.

Contributor

spk commented Feb 15, 2017

I've updated the patch according to the feedbacks and reported a fix in w3c-validators/w3c_validators#33

@spk spk force-pushed the spk:guides-validation branch Feb 16, 2017

@spk

This comment has been minimized.

Contributor

spk commented Feb 16, 2017

The patch was not correct; double checked everything works now

guides/w3c_validator.rb Outdated
@@ -32,23 +32,19 @@
module RailsGuides
class Validator
def validate
validator = MarkupValidator.new
# https://github.com/w3c-validators/w3c_validators/issues/25
validator = NuValidator.new(validator_uri: "https://validator.w3.org/nu/")

This comment has been minimized.

@robin850

robin850 Feb 23, 2017

Member

It looks this it is already pointing to this URL so there may be no need to specify the URL.

@robin850

This comment has been minimized.

Member

robin850 commented Feb 23, 2017

I can reproduce this problem on my computer as well.

Actually, the MarkupValidator is using the https://validator.w3.org/check URL to validate documents and it looks like it is deprecated, using NuValidator seems to be the preferred way.

I don't think it's necessary to change the error handling though, could you just use NuValidator instead of MarkupValidator and left the rest unchanged please ?

Thanks for the patch by the way ! :-)

@spk spk force-pushed the spk:guides-validation branch to d150ef0 Feb 23, 2017

@spk

This comment has been minimized.

Contributor

spk commented Feb 23, 2017

I don't think it's necessary to change the error handling though, could you just use NuValidator instead of MarkupValidator and left the rest unchanged please ?

For me its better to know when there is a "problem" but its reverted as you asked

Thanks for the patch by the way ! :-)

You are welcome, for HTML validation !

@robin850

This comment has been minimized.

Member

robin850 commented Feb 23, 2017

For me its better to know when there is a "problem" but its reverted as you asked

This problem would still be shown with the else statement, ATM, no ?

@rafaelfranca rafaelfranca merged commit 18afe45 into rails:master Feb 23, 2017

2 checks passed

codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@spk

This comment has been minimized.

Contributor

spk commented Feb 24, 2017

This problem would still be shown with the else statement, ATM, no ?

Yes will be shown but will be skipped if no one look a them, so problem was hidden by this rescue because using Exception and not validation error
Anyway its merged it will really validate now \o/

@spk spk deleted the spk:guides-validation branch Feb 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment