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

Skip folder using path_patterns #16

Open
iam4code opened this issue Nov 14, 2019 · 1 comment
Open

Skip folder using path_patterns #16

iam4code opened this issue Nov 14, 2019 · 1 comment

Comments

@iam4code
Copy link

iam4code commented Nov 14, 2019

Hi,

Is there a way to use path_patterns to filter out folders in a maintainability check?
I would like to skip a specific check for a specific folder. Note that I do not want to skip this directory for any other checks.

I'm trying to use a path pattern like below to skip all the foo directory but this skips all the directories.

path_patterns:
  - "src/**[!foo]/*[!test].js"
path_patterns:
  - "src/**/!(foo)/*[!test].js
@wfleming
Copy link

wfleming commented Nov 14, 2019

Rub's Dir[] is used to process these glob patterns (https://github.com/codeclimate/codeclimate-grep/blob/master/lib/cc/engine/scanner.rb#L37).

Ruby's glob doesn't support the negation pattern you're using, unfortunately. But you may be able to devise a pattern that would match what you're after using reg-ex style [^foo] matchers? I linked to Ruby's docs for their globbing above, you can read those to see if you you can devise a pattern that works for you.

Aside from that, sorry, there is not currently support for this level of exclusion. If there aren't that many folders you're working with, and you can't get a [^foo] pattern to do what you want, you could list several patterns for the different folders you do want to scan.

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