feat: Create common golangci-lint config#108
Open
walldiss wants to merge 1 commit intocelestiaorg:mainfrom
Open
feat: Create common golangci-lint config#108walldiss wants to merge 1 commit intocelestiaorg:mainfrom
walldiss wants to merge 1 commit intocelestiaorg:mainfrom
Conversation
MSevey
approved these changes
Jun 7, 2024
Contributor
|
are you thinking this will be a reference file or that you want a common reuseable workflow to call this file? |
Member
Author
|
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. |
cristaloleg
reviewed
Jun 12, 2024
| timeout: 5m | ||
|
|
||
| linters: | ||
| enable: |
| source: "https://" | ||
| max-same-issues: 50 | ||
|
|
||
| linters-settings: |
There was a problem hiding this comment.
Plus
nakedret:
# No naked returns, ever.
max-func-lines: 1
| - lll | ||
| source: "https://" | ||
| max-same-issues: 50 | ||
|
|
There was a problem hiding this comment.
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.
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.
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: ""
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.