-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Create common golangci-lint config #108
base: main
Are you sure you want to change the base?
Conversation
are you thinking this will be a reference file or that you want a common reuseable workflow to call this file? |
I'm thinking it could be a good reference for others to follow the rules we found useful in Node. It can be imported optionally, but I would suggest making a local copy in case the config needs to be modified in accordance with local contextual requirements. |
timeout: 5m | ||
|
||
linters: | ||
enable: |
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.
Let's sort enabled checks please.
source: "https://" | ||
max-same-issues: 50 | ||
|
||
linters-settings: |
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.
Plus
nakedret:
# No naked returns, ever.
max-func-lines: 1
- lll | ||
source: "https://" | ||
max-same-issues: 50 | ||
|
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.
Based on https://olegk.dev/go-linters-configuration-the-right-version (shameless plug):
output:
# Must have. Easier to understand the output.
print-linter-name: true
# No, no skips, everything should be reported.
uniq-by-line: false
# To be honest no idea when this can be needed, maybe a multi-module setup?
path-prefix: ""
# Slightly easier to follow the results + getting deterministic output.
sort-results: true
- asciicheck | ||
- dupword | ||
|
||
issues: |
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.
Based on https://olegk.dev/go-linters-configuration-the-right-version (shameless plug):
issues:
# I found it strange to skip the errors, setting 0 to have all the results.
max-issues-per-linter: 0
# Same here, nothing should be skipped to not miss errors.
max-same-issues: 0
@@ -0,0 +1,66 @@ | |||
run: | |||
timeout: 5m |
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.
Plus:
# This is very important, bugs in tests are not acceptable either.
tests: true
# With the read-only mode linter will fail if go.mod file is outdated.
modules-download-mode: readonly
# Keep this empty to use the Go version from the go.mod file.
go: ""
Introduce common golangci-lint config that can be reused across celestiaorg repos. The list of suggested linters is based on what is currently used in https://github.com/celestiaorg/celestia-node. Feel free to suggest linters to include / exclude.