This repository is the official, managed repository for integration actions and linters into trunk. It is imported by default in all trunk configurations.
By consolidating and sharing integrations for linters/actions into a single repository we hope to make the discovery, management and integration of new tools as straight-forward as possible.
- Support for Detekt is under active development; see our docs for more details.
- Module inspection, deep checking, and setting variables are not currently supported.
trunk check enable {linter}
action | description |
---|---|
buf-gen |
run buf on .proto file change |
commitlint |
enforce conventional commit message for your local commits |
go-mod-tidy |
automatically tidy go.mod file |
go-mod-tidy-vendor |
automatically tidy and vendor go.mod file |
trunk actions enable {action}
Read more about how to use plugins here.
Our goal is to make engineering faster, more efficient and dare we say - more fun. This repository will hopefully allow our community to share ideas on the best tools and best practices/workflows to make everyone's job of building code a little bit easier, a little bit faster and maybe in the process - a little bit more fun.
Some linters provide built-in formatters or autofix options that don't always produce ideal outputs, especially in conjunction with other formatters. Trunk supports defining autofix options for these linters, but has their formatting turned off by default. An example of this is sqlfluff:
- name: sqlfluff
files: [sql, sql-j2, dml, ddl]
runtime: python
package: sqlfluff
direct_configs:
- .sqlfluff
commands:
- name: lint
run: sqlfluff lint ${target} --format json --dialect ansi --nofail
output: sarif
success_codes: [0]
read_output_from: stdout
parser:
runtime: python
run: ${plugin}/linters/sqlfluff/sqlfluff_to_sarif.py
- name: fix
run: sqlfluff fix ${target} --dialect ansi --disable-progress-bar --force
output: rewrite
formatter: true
in_place: true
success_codes: [0]
enabled: false
The fix
subcommand has enabled: false
, so when you run trunk check enable sqlfluff
, only the
lint
subcommand is enabled. To override this behavior in your trunk.yaml, specify commands:
lint:
enabled:
- sqlfluff:
commands: [lint, fix]