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

file-ignore not ignoring properly #459

Closed
johlym opened this issue Oct 18, 2017 · 7 comments
Closed

file-ignore not ignoring properly #459

johlym opened this issue Oct 18, 2017 · 7 comments
Assignees
Labels

Comments

@johlym
Copy link

johlym commented Oct 18, 2017

I followed #177 first to make sure I wasn't doing something dumb but I'm still at a loss, here.

I'm running:

htmlproofer _site --allow-hash-href --check-html --disable-external --alt-ignore --file-ignore /bar/ --log-level debug

against this folder structure:

_site
  |- foo
    |- bat
    |- car
  |- bar
    |- baz
    |- bow

I want everything in /_site/foo to be checked, but to skip /_site/bar altogether. It seems to want to check bar anyway.

Based on what I read in #177, this should be working. What am I missing?

@gjtorikian
Copy link
Owner

Could you try

 --file-ignore '/bar/'

@johlym
Copy link
Author

johlym commented Oct 18, 2017

Tried that, same result :/

Actual command:

htmlproofer _site --allow-hash-href --check-html --disable-external --alt-ignore --file-ignore '/kb/' --log-level debug

but I'm still see everything within _site/kb/ being both checked and showing up like in this sample output (there are hundreds of files and folders in this folder, in reality):

Checking scriptcheck on _site/kb/index.html ...
Checking linkcheck on _site/kb/index.html ...
Checking htmlcheck on _site/kb/index.html ...
Checking imagecheck on _site/kb/index.html ...

...

- _site/kb/index.html
  *  75:10: ERROR: Unexpected end tag : ul (line 75)

And for the record:

gem list html-proofer

*** LOCAL GEMS ***

html-proofer (3.7.4)

@gjtorikian gjtorikian self-assigned this Oct 19, 2017
@gjtorikian gjtorikian added the bug label Oct 19, 2017
@gjtorikian
Copy link
Owner

Hmm, I tested this locally, and this is dumb if this is the fix, but what happens if you swap the arguments, like:

htmlproofer --allow-hash-href --check-html --disable-external --alt-ignore --file-ignore '/kb/' --log-level debug _site

@johlym
Copy link
Author

johlym commented Oct 19, 2017

Interesting, this introduced a new but not desired behavior:

htmlproofer --allow-hash-href --check-html --disable-external --alt-ignore --file-ignore '/kb/' --log-level debug _site
Running ["ScriptCheck", "ImageCheck", "LinkCheck", "HtmlCheck"] on /kb/ on *.html...


Ran on 0 files!


HTML-Proofer finished successfully.

pulling --file-ignore '/kb/' restores it to normal behavior, including scanning the directory I don't want.

@norristh
Copy link

norristh commented Aug 5, 2018

I had the same problem. The fix at Stack Overflow works for me: escape forward slashes.

I tried it with a regular expression like '#/bar/#' to be cleaner, but it didn't work to exclude bar. But this did:

--file_ignore "/\/bar\//"

@mcbanderson
Copy link

Had this same issue when trying to scan everything in my _site directory, but exclude files in _site/node_modules. Adding double quotes around the specified directory worked for me using version 3.10.2:
htmlproofer ./_site --allow-hash-href --check-favicon --check-html --disable-external --file-ignore "/node_modules/"

@gjtorikian
Copy link
Owner

Thanks for that. I already had this documented in the README: https://github.com/gjtorikian/html-proofer#special-cases-for-the-command-line

Glad that you've found a solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants