html-proofer icon indicating copy to clipboard operation
html-proofer copied to clipboard

`--error-sort` flag hides error message output when specified

Open justwheel opened this issue 3 years ago • 3 comments

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

justwheel avatar Mar 10 '22 16:03 justwheel

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

gjtorikian avatar Mar 10 '22 16:03 gjtorikian

@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.

justwheel avatar Mar 10 '22 18:03 justwheel

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!

gjtorikian avatar Mar 13 '22 22:03 gjtorikian