Run Linters
The main commands when running trunk
from the command line are:
You can always find this list using trunk check --help
.
Trunk is git-aware. When you run trunk check
it will only run on files you've modified according to git. To run on a sampling in your repo, run: trunk check --sample 5
check
trunk check
runs linters & formatters on your changed files, prompting you to apply fixes. Without additional args, trunk check
will run all applicable linters on all files changed in the current branch.
fmt
Run all applicable formatters as configured in trunk.yaml
. trunk fmt
is short-hand for running
trunk check
with a --fix --filter
set to all formatters enabled in your repository.
Options
options | |
---|---|
| Run on all the files in the repository. Useful if trying to assess a new linter in the system, or to find and fix pre-existing issues |
| Auto-apply all suggested fixes |
| Surface, but do not prompt for autofixes |
| List of comma-separated linters to run. Specify |
| Run check on a sampling of all files in the repo |
| Output help information |
Recipes
Check | Command |
---|---|
all files |
|
a specific file |
|
all applicable files with flake8 |
|
a selection of five files in the repo |
|
a selection of five files in the repo with a specific linter |
|
format the whole repo |
|
format a specific file |
|
format all python code with |
|
Last updated