Dependencies
Last updated
Last updated
Linters use the tools
section of the .trunk/trunk.yaml
to specify Trunk configured binaries that the linter uses to run. The linter.definitions.tools
key specifies a list of tool names. There are two ways for a linter to depend on a tool: and
When the name of the tool matches the name of a linter, it is called an eponymous tool dependency.
In the example below the pylint
linter depends on the pylint
tool, which is defined as the package pylint
running with the python
runtime.
Eponymous tools need to be defined separately from the linter but implicitly enabled with the linter's version. You may explicitly enable the eponymous tool if you wish, but note that its version needs to be synced to that of the linter. See the page for more details on how to set up Tools.
You can also have a scenario where a linter depends on a tool that is not identically named - an additional tool dependency. We give an example below:
In this scenario, terraform
is an additional tool dependency - terragrunt
requires it to be in $PATH
. If the tool is an additional dependency, it must be enabled explicitly and versioned independently of the linter - that is, it must be listed in the tools.enabled
section.
If your linter can be downloaded via gem install
, go get
, npm install
, or pip install
, you can specify a runtime
and the package
key:
This will now create a hermetic directory in ~/.cache/trunk/linters/fizz-buzz
and npm install fizz-buzz
there. You can refer to different versions of your package in trunk.yaml
as normal, via fizz-buzz@1.2.3
.
Note: Such downloads will use the hermetic version of the specified runtime that
trunk
installs, not the one you've installed on your machine.
See for more information.