Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
There is no universal setting for excluding a directory from static analysis. Configure the analyzer or integration that actually produces the findings, and first decide whether you need to stop files being scanned, change which files belong to a project, or hide diagnostics. Those outcomes differ: a quiet report does not necessarily mean the tool skipped the directory.
Choose the right kind of exclusion
“Exclude this directory” can mean three different things. Knowing which one you need helps explain why a setting may appear to work while analysis continues—or why results disappear even though the tool still processed the files.
- Skip scanning: The tool does not discover or analyze matching files.
- Change project membership: A build or language configuration changes which files are considered part of the program. Other files may still enter through imports or explicit references.
- Filter diagnostics: The tool analyzes files but hides some or all findings from them.
For example, TypeScript’s exclude affects files found through include; it does not ensure a file stays out of the program if that file is imported or listed another way. Clang-Tidy’s header exclusion filters diagnostics from matching headers rather than removing those headers from analysis. See the TypeScript TSConfig reference and Clang-Tidy documentation.
Free tools Windows power users keep installed
One-click scans. No signup required.
Identify which tool and integration is running
Before changing a pattern, find out where the findings come from. A local CLI, editor extension, pre-commit hook, build plugin, and CI job may invoke different analyzers or apply different settings.
#1 Best Overall
- Identify the exact analyzer and command or integration producing the results.
- Locate that integration’s documented exclusion setting and pattern syntax.
- Check the pattern’s base: it may be relative to the repository root, configuration file, current directory, or an absolute path.
- Check whether matching is limited to one directory beside the configuration or applies recursively.
- Use the same command or integration that matters—especially the CI or editor path—to verify the change.
Do not assume that a setting for a local command also controls an editor, build plugin, or CI job. Likewise, an ignore file only affects tools that document support for it.
Configure an exclusion in common tools
These examples use each tool’s own configuration model. Do not copy a glob from one tool into another without checking its path and recursion semantics.
ESLint flat configuration
In flat config, use the documented globalIgnores() helper to ignore directories. This example ignores generated/ beside the config file:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
// eslint.config.js
import { defineConfig, globalIgnores } from "eslint/config";
export default defineConfig([
globalIgnores(["generated/"]),
]);
To match directories named generated anywhere in the tree, use **/generated/. ESLint distinguishes global ignores, which can match directories, from configuration-specific ignores, which match filenames. Its documentation also explains how directory traversal affects patterns that restore selected files: build/** prevents traversal into the directory, whereas build/**/* allows later patterns to unignore selected contents. See ESLint ignore files.
Ruff
Ruff accepts configuration in pyproject.toml, ruff.toml, or .ruff.toml. To add a directory to Ruff’s default exclusions without replacing the defaults, use extend-exclude:
[tool.ruff]
extend-exclude = ["generated"]
Ruff patterns can be a path or name, or a relative pattern resolved from the project root or configuration location. Ruff respects .ignore, .gitignore, .git/info/exclude, and global Git ignore files by default. However, if an excluded file is passed directly to Ruff, it is analyzed unless force-exclude = true is set. That option matters for hooks that pass changed filenames explicitly. See Ruff configuration and Ruff settings.
Semgrep
Semgrep supports .semgrepignore and .gitignore for excluding files from scans. Its documentation describes .semgrepignore as following the .gitignore specification, so patterns can target directories such as tests/ or generated-code folders. Actual targets can also depend on scan mode, platform-side ignored paths, and default ignores; check what the specific scan is using. See Semgrep’s explanation of file targeting and ignore files.
Recommended Free Tools
TypeScript project membership
In tsconfig.json, exclude limits files resolved through include; it is not a universal “never analyze this path” rule. A file can still enter the TypeScript program through an import, the types setting, a triple-slash reference, or the files list. See the TypeScript TSConfig reference.
Clang-Tidy header diagnostics
--exclude-header-filter filters diagnostics from headers matching a regular expression and must be used with --header-filter. It does not remove translation units from analysis, and diagnostics from each translation unit’s main file remain visible. Use it to reduce noise from third-party or system-header diagnostics, not to prevent source files from being analyzed. See Clang-Tidy documentation.
Checkstyle command line
Checkstyle’s CLI accepts -e or --exclude followed by a file or directory path. The path can be absolute or relative to the current directory, and you can supply multiple exclusions. If Maven or Gradle runs Checkstyle, inspect that task’s own include and exclude settings; CLI behavior alone does not establish how a build wrapper behaves. See Checkstyle command-line documentation.
Check ignore files, explicit paths, and wrappers
A pattern that works during a recursive scan may not work when a hook supplies individual filenames. Explicit file arguments can also behave differently from normal file discovery. Ruff documents this exception and provides force-exclude for it; other tools may have different rules.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →- Confirm whether the analyzer reads
.gitignore, a tool-specific ignore file, or neither. - Find out whether a hook or wrapper passes explicit paths that can bypass discovery exclusions.
- Check whether the build or language configuration, rather than the analyzer’s ignore setting, defines project membership.
- Compare the editor, local CLI, pre-commit, and CI configurations if findings differ between them.
Pattern anchoring is tool-specific, too. In ESLint global ignores, generated/ targets the directory beside the config, while **/generated/ matches recursively. A pattern that looks similar in another tool may resolve differently.
Best Value
Verify that the intended files are excluded
Check the real execution path, not just the edited configuration. When the tool provides an effective configuration or target-file list, inspect it. Then run the same command or integration that produces the findings and confirm that the intended directory is absent from analysis—or that only the intended diagnostics are hidden.
- Test a file inside the target directory and a similar file outside it, so you can catch both missed matches and overbroad patterns.
- If analysis still reports files, check imports, explicit file arguments, wrapper settings, and whether the setting filters diagnostics instead of stopping analysis.
- If files disappear from results, confirm that maintained source has not been caught by a broad directory or recursive pattern.
- Review exclusions periodically so a temporary workaround does not silently reduce coverage over time.
Decide whether to exclude a directory or suppress findings
For generated or vendored code, a narrow directory exclusion can reduce noise and scan time, but it also removes that content from analysis. If maintained files share the directory, target a generated subdirectory or filename convention instead. If only particular findings are unwanted, prefer a rule-specific or file-specific suppression where the tool supports it; that preserves checks for other issues in the same files.
Avoid broad exclusions for production source, shared utilities, or all tests unless removing them from analysis is an intentional trade-off. Keep the pattern narrow and the reason clear so future maintainers can tell what coverage it removes.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

