Documentation Index
Fetch the complete documentation index at: https://trunk-4cab4936-sam-gutentag-flaky-tests-new-monitors.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Ignoring parts of a file
Sometimes we want to deliberately tell a linter that, yes, I know what I’m doing, and yes, in any other situation I should not do this, but in this specific case it’s fine. Maybe there’s a dummy private key you’re using for a test stack, or fixing the lint issue will actually make your code less readable: whatever it is, you now need to figure out how to suppress a given lint issue. Trunk provides a simple, standardized mechanism to do this, saving you from having to look up the linter-specific syntax for doing so:clang-tidy linter found a modernize-use-nullptr issue on the highlighted line and that Trunk should suppress this linter issue.
Comments may be omitted:
trunk-ignore directives can also be placed at the end of the line on which they’re suppressing lint issues:
trunk-ignore supports that too:
trunk-ignore directives can also apply to other trunk-ignores if need be:
Ignoring all issues/formatting in a file
You can also ignore all issues or formatting in a file:trunk-ignore-all is not required to be the first line of a file, because we recognize that other constructs (shebangs, front matter, docstrings) may need to take precedence.Ignoring all issues in a code block
Alternatively, you can ignore all matching issues in a code block:Tracking unused ignores
Trunk will alert you if yourtrunk-ignore directives are unused. This can happen due to user error or even innocuously over time, for example, if your internal APIs change or if a linter’s output changes.
note severity, indicating they are non-blocking by default.
If you need to, you can ignore issues from unused trunk-ignore directives, using trunk-ignore(trunk):
Specification
The syntax of a trunk-ignore directive is as follows:Ignoring multiple files
Some files are never meant to be checked, such as generated code. To ignore them, use theignore key to your .trunk/trunk.yaml file:
ignore defines both a set of linters and a set of paths to ignore.
| Key | Value |
|---|---|
| linters | List of linters (i.e. [black, eslint]) or the special [ALL] tag |
| paths | List of glob paths, relative to the root of the repo, to ignore. If a path begins with a ! then it represents an inverse ignore. This means that any file matching that glob will not be ignored, even if matched by other globs. |
Trunk is
git-aware, which means it ignores gitignore'd files by default.Known issues
trunk-ignore does not currently support:
- suppressing findings on lines 0 or 1 using inline/block directives