LogoLogo
SlackLogin
  • Overview
    • Welcome
  • Setup & Configuration
    • Connecting to Trunk
    • Managing Your Organization
      • GitHub App Permissions
  • Integration with Slack
  • Flaky Tests (Beta)
    • Overview
    • Get Started
      • Test Frameworks
        • Android
        • Bazel
        • Behave
        • cargo-nextest
        • Cypress
        • Dart Test
        • Go
        • GoogleTest
        • Gradle
        • Jasmine
        • Jest
        • Karma
        • Maven
        • minitest
        • Mocha
        • Nightwatch
        • NUnit
        • Pest
        • PHPUnit
        • Playwright
        • Pytest
        • Robot Framework
        • RSpec
        • Swift Testing
        • Vitest
        • XCTest
        • Other Test Frameworks
      • CI Providers
        • Azure DevOps Pipelines
        • BitBucket Pipelines
        • Buildkite
        • CircleCI
        • Drone CI
        • GitHub Actions
        • GitLab
        • Jenkins
        • Semaphore CI
        • TeamCity
        • Travis CI
        • Other CI Providers
    • Dashboard
    • Flaky Test Detection
    • Quarantining
    • PR Comments
    • Ticketing Integrations
      • Jira Integration
      • Linear Integration
      • Other Ticketing Platforms
    • Webhooks
      • Slack Integration
      • Microsoft Teams Integration
      • GitHub Issues Integration
      • Linear Integration
    • Uploader CLI Reference
  • Merge Queue
    • Overview
    • How does it work?
    • Setup
      • Quick Start
      • Settings
      • Integration for Slack
    • Concepts and Optimizations
      • Predictive Testing
      • Optimistic Merging
      • Pending Failure Depth
      • Anti-Flake Protection
      • Batching
      • Parallel Queues
        • Bazel
        • Nx
        • API
      • FAQ
    • Priority
    • Managing Merge Queue
      • Using the Merge UI
      • Metrics
      • Command Line
    • Webhooks
    • Reference
  • Code Quality
    • Overview
    • Why Metalinters?
      • How does it work?
      • Why Code Quality?
    • Setup & Installation
      • Initialize Trunk
      • Local Linting
      • Linting in CI
      • Nightly Report (Deprecated)
    • IDE Integration
      • VSCode
      • Neovim
      • GitHub Codespaces
    • Linters
      • Supported Linters
        • Actionlint
        • Ansible-lint
        • Autopep8
        • Bandit
        • Biome
        • Black
        • Brakeman
        • buf
        • Buildifier
        • cfnlint
        • Checkov
        • circleci
        • ClangFormat
        • clang-tidy
        • Clippy
        • cmake-format
        • codespell
        • cspell
        • cue-fmt
        • dart
        • deno
        • Detekt
        • djlint
        • dotenv-linter
        • dotnet-format
        • dustilock
        • ESLint
        • Flake8
        • git-diff-check
        • Gitleaks
        • Gofmt
        • gofumpt
        • goimports
        • gokart
        • golangci-lint
        • golines
        • google-java-format
        • graphql-schema-linter
        • hadolint
        • haml-lint
        • isort
        • iwyu
        • ktlint
        • kube-linter
        • markdown-link-check
        • markdown-table-prettify
        • Markdownlint
        • markdownlint-cli2
        • mypy
        • nancy
        • nixpkgs-fmt
        • opa
        • OSV-Scanner
        • Oxipng
        • perlcritic
        • perltidy
        • php-cs-fixer
        • phpstan
        • pmd
        • pragma-once
        • pre-commit-hooks
        • Prettier
        • prisma
        • psscriptanalyzer
        • Pylint
        • pyright
        • regal
        • remark-lint
        • renovate
        • rome
        • rubocop
        • Ruff
        • rufo
        • rustfmt
        • scalafmt
        • semgrep
        • ShellCheck
        • shfmt
        • sort-package-json
        • sourcery
        • sql-formatter
        • SQLFluff
        • sqlfmt
        • squawk
        • standardrb
        • stringslint
        • stylelint
        • stylua
        • SVGO
        • swiftformat
        • swiftlint
        • taplo
        • Terraform
        • terragrunt
        • terrascan
        • TFLint
        • tfsec
        • tofu
        • Trivy
        • Trufflehog
        • txtpbfmt
        • vale
        • Yamllint
        • yapf
      • Run Linters
      • Manage Linters
      • Configure Linters
      • Ignoring Issues and Files
      • Custom Linters
      • Shared Configs
      • Upgrades
    • Debugging
    • Licensing
  • CLI & API References
    • CLI Reference
      • Install
      • Getting Started
        • Code Quality
        • Merge Queue
        • Flaky Tests
        • Tools
        • Actions
          • Git Hooks
        • Announce
      • Compatibility
      • Caching
      • Commands Reference
        • Code Quality
        • Actions
        • Merge
      • Configuration
        • Plugins
          • Share Config Between Codebases
          • Exporting Linter Configs
        • Runtimes
        • Tools
        • Lint
          • Definitions
          • Commands
          • Output
          • Output Parsing
          • Files and Caching
          • Dependencies
          • Auto-Enable
        • Actions
          • Notifications
          • Logging and Troubleshooting
        • Merge
        • Telemetry
        • Per User Overrides
    • API Reference
      • Flaky Tests
      • Merge Queue
      • Webhooks Reference
  • Pricing & Security
    • Security
  • Billing
  • Community & Support
  • Links
    • Open App
    • Slack Community
    • Changelog
    • Feature Requests
On this page
  • Lint Config
  • bazel
  • comment_formats
  • compile_commands
  • compile_commands_roots
  • default_max_file_size
  • definitions
  • disabled
  • downloads
  • enabled
  • exported_configs
  • extra_compilation_flags
  • files
  • ignore
  • reuse_upstream
  • runtimes
  • skip_missing_compile_command
  • threshold
  • upstream_mode
Edit on GitHub
  1. CLI & API References
  2. CLI Reference
  3. Configuration

Lint

Last updated 6 months ago

Lint Config

The lint section of .trunk/trunk.yaml represents the configuration of all linters. This is where you can:

  • Define the linters (lint.definitions),

  • List linters to enable and disable (lint.enabled and lint.disabled)

  • Define file categories (lint.files)

  • List required runtimes and downloads.

  • And additional cross-linter settings.

bazel

bazel: bazel configuration

  • paths locations to look for Bazel binary. .

comment_formats

comment_formats: Definitions of comment formats. Reused in linter definitions. Trunk Quality already defines many common comment format such as hash (# comment), slashes-block (/* comment */), and slashes-inline (// comment). For the full list .

To create a new comment format provide the name and delimiters like this:

lint:
  comment_formats:
    - name: dashes-block
      leading_delimiter: --[[
      trailing_delimiter: --]

compile_commands

compile_commands: compile commands for clang-tidy. Must be one of json or bazel.

compile_commands_roots

compile_commands_roots: Directories to search for compile_commands.json. The default is build/.

default_max_file_size

default_max_file_size: Default maximum filesize in bytes. Trunk Code Quality will not run linters on any files larger than this. Default value is 4 megabytes.

definitions

disabled

downloads

enabled

enabled: The list of linters to enable. Linter names can be in the form of <name> or <name>@<version>. Examples:

lint:
  enabled:
    # Mutually exclusive, choose one:
    - eslint # Use the system version of markdownlint
    - eslint@9.0.0 # Use a hermetically managed version of eslint
    - eslint@node # Use eslint from node_modules/.bin

exported_configs

extra_compilation_flags

extra_compilation_flags: When running clang-tidy, this list will be appended to the compile command.

files

files: Definitions of filetypes

Every linter must define the set of filetypes it applies to in the lint.files section.

New filetypes are defined with the name and extensions properties. They may also include the comments properties to describe what style of comments are used in these files.

lint:
  files:
    - name: c++-source
      extensions:
        - C
        - cc
        - cpp
        - cxx
      comments:
        - slashes-block
        - slashes-inline

ignore

ignore: files to be ignored by linters.

reuse_upstream

reuse_upstream: If enabled, Trunk will cache upstream sandboxes instead of creating a new one each time. Options are true, or false.

runtimes

skip_missing_compile_command

skip_missing_compile_command: For linters that depend on compile commands, setting this will cause Trunk to skip files without a compile command rather than report an error.

threshold

upstream_mode

upstream_mode: How to generate the upstream sandbox used for generating lint results for revisions not currently checked out. Options aresymlink (default), hardlink, or copy. If using copy, it can be slow without also enabling reuse_upstream: true.

definitions: Where you define or override linter settings. See .

disabled: The list of linters to disable. Adding a linter here will prevent trunk from suggesting it as a new linter each time you upgrade. Linter names can be in the form of <name> or <name>@<version>, the same format as the property.

downloads: Locations to download binary artifacts from. Using instead is preferred.

exported_configs: Linter configs to export when another project is

This is how the C++ source filetype is defined. See also .

runtimes: Node, python, cargo, etc. Used to define or override a runtime environment for package management. .

threshold: where you specify the blocking behavior of linters. The for whether an error from a linter should block commits or not.

Linter Definition Config
tool definitions
importing this plugin
Files and Caching
See Runtimes
enabled
see the linters plugin.yaml
Example
threshold