File Pattern Exclusions
A list of glob patterns (*, **, ?, case insensitive). Files matching any pattern are skipped when calculating Calories and Lines, for example lockfiles or automatically generated directories.
Three limits apply:
| Limit | Value |
|---|---|
| Number of patterns | up to 100 |
| Length of a single pattern | up to 200 characters |
| Wildcard characters in a single pattern | up to 10 |
The wildcard character limit is used up quickly with deeply nested paths. A pattern with several ** segments exhausts it fast, and at that point it is simpler to exclude the parent directory than to build a precise path.
What is worth excluding
Q247 applies no exclusions by default, so at the start every file counts. The groups below are a proposal to review with the team: what they have in common is that a change to such a file does not correspond to a developer's work, yet can be large and drive up Calories and Lines.
Dependency lock files. Generated entirely by a tool command, and a single update changes thousands of lines.
**/package-lock.json
**/yarn.lock
**/pnpm-lock.yaml
**/composer.lock
**/Gemfile.lock
**/poetry.lock
**/go.sum
**/Podfile.lock
Automatically generated code. Typical for API client generators, ORMs and schema compilers.
**/generated/**
**/*.g.dart
**/*.freezed.dart
**/*.pb.go
**/*_pb2.py
**/*.designer.cs
Project and build files of mobile applications. In iOS and Android projects these are maintained by the environment, not written by hand.
**/*.pbxproj
**/*.xcworkspacedata
**/R.java
**/*.iml
Dependencies kept in the repository. Directories with someone else's code, versioned together with your own.
**/node_modules/**
**/vendor/**
**/Pods/**
**/third_party/**
Build output and minified files. These are derived from the source code, so they would be counted twice.
**/dist/**
**/build/**
**/*.min.js
**/*.min.css
**/*.map
Large data files and test snapshots. Often written by a single command and disproportionate in size to the effort involved.
**/*.snap
**/fixtures/**
**/testdata/**
Configuration files are two different cases. Configuration written by hand, such as Kubernetes manifests, CI pipeline definitions or Terraform files, is real engineering work, and excluding it understates the result of the people responsible for infrastructure.
So exclude configuration that is generated or synchronized by a machine, for example exported dashboard definitions, tool settings dumps or .env.example files filled in by a script.
Start with a few patterns that generate the most noise in a given repository, and add more after reviewing the results. Every change to the list recalculates history, so a handful of well-targeted patterns works better than dozens chosen by feel.
Adding or removing a pattern does not only affect the future: it also recalculates previously collected data. On a large organization this can take a while.
See also
- Calories, Increments and Lines: metrics calculated from the files covered by the analysis
- Excluding commits: excluding entire commits, not individual files
- Increment visibility: the Calories threshold for a single increment