From 97a0c23cf8a4a368c7b8d5b3554d81f42ae84a83 Mon Sep 17 00:00:00 2001 From: Russell Davis <551404+russelldavis@users.noreply.github.com> Date: Wed, 9 Jan 2019 11:38:03 -0800 Subject: [PATCH] Match dots in ignorePatterns globs; fixes .venv not being ignored Without this, the default `**/site-packages/**/*.py` ignorePattern fails to ignore site-packages in the .venv directory (a standard directory name for virtual environments, which even this project recommends using) --- news/2 Fixes/3947.md | 2 ++ src/client/linters/lintingEngine.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 news/2 Fixes/3947.md diff --git a/news/2 Fixes/3947.md b/news/2 Fixes/3947.md new file mode 100644 index 000000000000..7e2ba52b466a --- /dev/null +++ b/news/2 Fixes/3947.md @@ -0,0 +1,2 @@ +Match dots in ignorePatterns globs; fixes .venv not being ignored +(thanks to [Russell Davis](https://github.com/russelldavis)) diff --git a/src/client/linters/lintingEngine.ts b/src/client/linters/lintingEngine.ts index 066080250e7d..7f65cf410c2d 100644 --- a/src/client/linters/lintingEngine.ts +++ b/src/client/linters/lintingEngine.ts @@ -197,7 +197,8 @@ export class LintingEngine implements ILintingEngine { const relativeFileName = typeof workspaceRootPath === 'string' ? path.relative(workspaceRootPath, document.fileName) : document.fileName; const settings = this.configurationService.getSettings(document.uri); - const ignoreMinmatches = settings.linting.ignorePatterns.map(pattern => new Minimatch(pattern)); + // { dot: true } is important so dirs like `.venv` will be matched by globs + const ignoreMinmatches = settings.linting.ignorePatterns.map(pattern => new Minimatch(pattern, { dot: true })); if (ignoreMinmatches.some(matcher => matcher.match(document.fileName) || matcher.match(relativeFileName))) { return false; }