From 9d6e30701b98f856125e55ba3fd26fa6b8f4a280 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Fri, 12 Apr 2024 12:19:48 -0700 Subject: lint: add "make lint" target, run it from ci See https://github.com/tinygo-org/tinygo/issues/4225 Runs in both circleci and github, circleci is run on branch push, github is run on PR Revive builds so fast, don't bother installing it; saves us wondering which one we get Uses tools.go idiom to give control over linter versions to go.mod. Also pacifies linter re AppendToGlobal as a token first fix. TODO: gradually expand the number of directories that are linted, uncomment more entries in revive.toml, and fix or suppress the warnings lint finds. TODO: add linters "go vet" and staticcheck NOT TODO: don't add metalinters like golangci-lint that pull in lots of new of dependencies; we'd rather not clutter go.mod that much, let alone open ourselves up to the additional attack surface. --- revive.toml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 revive.toml (limited to 'revive.toml') diff --git a/revive.toml b/revive.toml new file mode 100644 index 000000000..f09127ca6 --- /dev/null +++ b/revive.toml @@ -0,0 +1,30 @@ +ignoreGeneratedHeader = false +severity = "warning" +confidence = 0.8 +errorCode = 0 +warningCode = 0 + +# Enable these as we fix them +[rule.blank-imports] +[rule.context-as-argument] +[rule.context-keys-type] +[rule.dot-imports] +[rule.error-return] +[rule.error-strings] +[rule.error-naming] +[rule.exported] +[rule.increment-decrement] +[rule.var-naming] +[rule.var-declaration] +#[rule.package-comments] +[rule.range] +[rule.receiver-naming] +[rule.time-naming] +[rule.unexported-return] +#[rule.indent-error-flow] +[rule.errorf] +#[rule.empty-block] +[rule.superfluous-else] +#[rule.unused-parameter] +[rule.unreachable-code] +#[rule.redefines-builtin-id] -- cgit v1.2.3