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

--error-sort flag hides error message output when specified #701

Open
jwflory opened this issue Mar 10, 2022 · 3 comments
Open

--error-sort flag hides error message output when specified #701

jwflory opened this issue Mar 10, 2022 · 3 comments

Comments

@jwflory
Copy link

jwflory commented Mar 10, 2022

Summary

When the --error-sort flag is specified at runtime, all error messages are suppressed regardless of which option is chosen. Removing the flag shows the error message output.

Steps to Reproduce

  1. Run htmlproofer on an HTML directory with --error-sort ':path' or any other option (e.g. :desc, :status)
  2. Error messages is suppressed.

A clear and concise description of what you expected to happen.

Show the details of the error messages. This behavior is the default if --error-sort is omitted.

htmlproofer exampleSite/public --allow-hash-href --alt-ignore --checks-to-ignore '' --check-html --disable-external --empty-alt-ignore --http-status-ignore '0,999' --timeframe '6w' --url-ignore '/inventory-hugo-theme/'

Running ["ScriptCheck", "LinkCheck", "ImageCheck", "HtmlCheck"] on ["exampleSite/public"] on *.html... 

Adding 0 links to the cache...
Removing 0 links from the cache...
Found 0 internal links in the cache...
Ran on 49 files!

- exampleSite/public/installation/configuration/index.html
  *  553:12: ERROR: Missing semicolon after character reference '&lt'.
        <b>&lt</b>
           ^ (line 553)
  *  557:17: ERROR: Missing semicolon after character reference '&gt'.
            <b> &gt</b>
                ^ (line 557)

HTML-Proofer found 2 failures!

What actually happened

htmlproofer exampleSite/public --allow-hash-href --alt-ignore --checks-to-ignore '' --check-html --disable-external --empty-alt-ignore --http-status-ignore '0,999' --timeframe '6w' --url-ignore '/inventory-hugo-theme/' --error-sort ':path'

Running ["ImageCheck", "HtmlCheck", "ScriptCheck", "LinkCheck"] on ["exampleSite/public"] on *.html... 

Adding 0 links to the cache...
Removing 0 links from the cache...
Found 0 internal links in the cache...
Ran on 49 files!

HTML-Proofer found 2 failures!

Other information

This makes debugging failed CI jobs more difficult. This is related to CircleCI-Public/hugo-orb#51 and has caused me trouble in my own repositories where I use htmlproofer to verify HTML output.

Operating System

  • Fedora Linux release 35 (Thirty Five)
  • ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

HTML-Proofer Version

htmlproofer 3.19.3

@jwflory jwflory changed the title -error-sort flag hides error message output when specified --error-sort flag hides error message output when specified Mar 10, 2022
@gjtorikian
Copy link
Owner

Thanks for the detailed report. Could I ask you to try the command with a new html-proofer, 4.0.0.rc3?

@jwflory
Copy link
Author

jwflory commented Mar 10, 2022

@gjtorikian I'm giving it a go, but I guess a lot of flags were removed. Is --error-sort no longer an option? Also, what is the best way to substitute --url-ignore flag? I have hundreds of errors for an internal site without that flag, but I'm not sure what the best replacement is from the --help message.

@gjtorikian
Copy link
Owner

Also, what is the best way to substitute --url-ignore flag?

It should now be ignore_urls.

Is --error-sort no longer an option?

Ack, that's right, I got rid of it. The suggested method now is to create your own error reporter, which sorts errors in the whatever way you've defined. The docs are kind of bare, but here's an example of how HTMLProofer does this by default: https://github.com/gjtorikian/html-proofer/blob/85c7aa07cf9d9a0c5fd46c15daeec043856c0ccf/lib/html_proofer/reporter/cli.rb

In essence, rather than html-proofer dictating how data should be presented, it sets up subclasses and objects for users to define their own custom behavior. Hope this helps!

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