Debugging
How to diagnose problems when a linter fails.
Sometimes you need to get under-the-hood to diagnose why a linter is failing on a particular file or to more easily reproduce an issue you are seeing with a tool.
Analyzing Linter Failures
When a linter fails, Trunk will generate a linter failure report that contains all the information needed to understand what went wrong and why. prettier
, for example, will fail on improperly formatted HTML; let's see what that looks like:
This tells us that prettier
failed when Trunk ran it on trunk/hello_world.html
and that we can find a full report of the invocation in .trunk/out/lYa9w.yaml
. This report will include:
the command that was run,
the environment (e.g.
cwd
, environment variables),the invocation's
stdout
,stderr
, and exit code, andrepro instructions.
All of this combined is generally sufficient to fix either the file or the tool to get useful results out of the linter.
Debugging Linter Failures in CI
If linter failures occur while Trunk Check is running in CI, you'll see something like this:
To debug these, you'll need get the linter failure report(s) from the Github Actions output. Click on "Details" to see a screen like this:
Then click on "View more details on trunk-io"
You'll then see your check run summary. Click "<your repo name>/pull_request" to see the CI logs, and scroll all the way to the bottom.
You'll then see a list of the failures that occurred, as well as all of the linter failure reports in collapsibles. You can then follow the instructions in Analyzing Linter Failures to resolve the problem.
Actions
When trunk check
is run, a dynamic set of check actions are generated and executed in parallel. An engineer developing custom integrations may find it helpful to examine in detail exactly what trunk check
does and sees when it runs a given tool. The output of the check
run will include an ACTIONS
section with a execution report for each action that was run as well as cache hit information.
For example, to run a report on all actions taken on hello.py:
Last updated