Skip to content

Linter Improvements

Ursa (9R) requested to merge ursa/lint into develop

This is a proposal for a few lint improvements and the integration of https://trunk.io as a meta-linter. The trunk integration will handle the running of golang-ci, shellcheck, and shfmt so those jobs have been removed from the CI pipeline. There is also support for gosec and semgrep, for which I'll integrate the custom configuration and remove those jobs in a subsequent pass.

trunk provides a couple conveniences:

  • Auto-fix for many of the lint errors
  • Only checks changes against upstream, so lots of linters don't slow it down too much
  • All linters can be ignore with a comment in generic // trunk-ignore(<linter>/<code>) format for any language

You can try out the lint changes with:

# install (https://trunk.io)
curl https://get.trunk.io -fsSL | bash

# lint
make lint

Once this is merged I'll create separate merge requests to:

  1. Run trunk check --all --upstream origin/develop and fix all errors
  2. Replace the existing gosec and semgrep jobs, adding the configuration in trunk
  3. Enable the additional linters commented in .golangci.yml and fix corresponding errors

Related Earmark Fixes

  1. Updated lint-handlers to avoid noisy errors messages for missing _archive.go files
  2. Renamed lint-erc20-token-list -> lint-erc20s for consistency with the script name
  3. Added make lint to run all lint targets
  4. Correctly added lint-pre target dependency, but disabled contents to avoid the noise from the lint fixes in this PR (since that has not been getting run in CI) - will fix those format errors and re-enable on the subsequent PR mentioned above

Merge request reports