-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lint with Trunk.io #14
Conversation
Firebreak implementation at https://github.com/trailofbits/firebreak/pull/341 |
Very interesting tool! Do the lint config files need to live in the It'd be nice if there were a way to specify where the config files live in |
They do not that's a good callout, this is just what From the docs:
|
💯
That sounds promising! |
I'm not super jazzed about having a third-party shell script in the root of all of our projects (it harkens back to the bad old days of
Making sure I understand: does I'm hoping it's the former, because IMO having to push things up to get linting results results in poor repo hygiene and will make it harder for us to make things external-contributor friendly (e.g. we'll need to make sure any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious to see how this will work with a C/C++ project, but I'm overall hesitant to push trunk
as our standard linting/CQA tool. To summarize my position:
- I'm not a big fan of an ambiguously licensed shell script copied into each of our repos, both from a maintenance/hygiene perspective and from a licensing/opacity perspective.
- I'm worried about the long-term stability of this solution: my personal experience with VC-backed ecosystem tooling hasn't been great (lots of disappearing projects, or projects that pivot to extreme prices once they have a captive customer base). Separately (and less seriously), I'd like to make sure
trunk
is no longer pinning local cores the way it seemed to the last time we evaluated it 🙂 - We need to make sure
trunk
doesn't violate our client obligations: we work with clients whose source code is not public and/or can't be shared (including through third-party assistive online services), so we need to ensure thattrunk
doesn't indefinitely retain copies of source code via its VSCode extension or whatever server-side state it uses. - As an abstract goal, I want our linting and CQA tooling to have an educational/growth component for engineers at ToB: IMO we should automate the annoying and fiddly stuff, but not at the cost of not exposing our engineers to details that will make them better overall engineers. The long term concern there then is that
trunk
cements a local maxima in our linting, since people will no longer be experimenting (as much) with individual tools and settings.
Answering my own question: |
Yes it will re-run locally, independently of CI, but local and CI do share the trunk.yaml config |
As far as I know there is no server-side state with this tool since we're not using their paid webapp features |
This isn't true they do have a webapp that trunk CI will upload results to, for a central place to view our linting status org wide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, one offline comment about what we're doing with make deps
etc. 🙂
Lints with trunk check.
Example implementation at https://github.com/trailofbits/firebreak/pull/341
Repo onboarding process
./trunk init
. This will scan your repo and generate a.trunk/trunk.yaml
with all the required linters.Linting workflow
Developers simply need to run
./trunk check
from the root of the repo to get the same CI linting results locally. No need to install anything manually.Run
./trunk fmt
to fix any linting issues.Trunk will cache and is diff aware locally so it will only run the appropriate linter and only on affected files.
There is also a VSCode extension that can be set as the default formatter https://marketplace.visualstudio.com/items?itemName=Trunk.io
Native VSCode linting
Trunk sidebar
./trunk check
prompts to auto formatPR annotations
Risks / downside
The
trunk
binary appears to be closed-source (I can't find the source) and trunk.io is a VC-backed startup. If trunk.io goes under we can still use the linting tools that it's wrapping with a make target. We should probably provide that by default for opensource projects.