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; }