Skip to content

feature: exclude/ignore paths via --glob flag #254

@acalvo

Description

@acalvo

Tightly related with #243

See this min repro: https://github.com/acalvo/vale-glob

It has the following structure:

- content/
  - a.md
  - b/
    - b.md
  - c.md

If I run vale ./content I get the following result:

 content/a.md
 1:1  error  Did you really mean 'Lorem'?  Vale.Spelling 
 1:7  error  Did you really mean 'ipsum'?  Vale.Spelling 


 content/b/b.md
 1:11  error  Did you really mean 'amet'?  Vale.Spelling 


 content/c.md
 1:1  error  Did you really mean 'Lorem'?  Vale.Spelling 
 1:7  error  Did you really mean 'ipsum'?  Vale.Spelling 

✖ 5 errors, 0 warnings and 0 suggestions in 3 files.

That's OK. But let's say I need to lint everything inside content/ except for the content/b/ subdir (because it is automatically generated content). Taking advantage of the --glob flag I'd try running vale --glob='!content/b/*' ./content. The result of that is this, though:

 content/a.md
 1:1  error  Did you really mean 'Lorem'?  Vale.Spelling 
 1:7  error  Did you really mean 'ipsum'?  Vale.Spelling 

✖ 2 errors, 0 warnings and 0 suggestions in 1 file.

a.md is linted (that's OK), b/b.md is not linted (which is also OK!), but... any other files alphabetically after that won't be linted (so no output for c.md).

If we rename c.md to aa.md, the result will be the expected one:

 content/a.md
 1:1  error  Did you really mean 'Lorem'?  Vale.Spelling 
 1:7  error  Did you really mean 'ipsum'?  Vale.Spelling 


 content/aa.md
 1:1  error  Did you really mean 'Lorem'?  Vale.Spelling 
 1:7  error  Did you really mean 'ipsum'?  Vale.Spelling 

✖ 4 errors, 0 warnings and 0 suggestions in 2 files.

This looks like a vale bug, doesn't it? Or is it a problem with https://github.com/gobwas/glob ? I've been playing around with the lib and seems to return the expected values in this case: https://play.golang.org/p/EBrkS4na90A ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions