-
Notifications
You must be signed in to change notification settings - Fork 8
ci: enable golangci-lint #38
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
Open
rchincha
wants to merge
1
commit into
project-machine:main
Choose a base branch
from
rchincha:fix-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: golangci-lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
pull_request: | ||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v5 | ||
with: | ||
cache: false | ||
go-version: '1.23' | ||
- uses: actions/checkout@v4 | ||
- name: Run linter with GH action | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: v1.64.8 | ||
|
||
# Optional: working directory, useful for monorepos | ||
# working-directory: somedir | ||
|
||
# Optional: golangci-lint command line arguments. | ||
# args: --issues-exit-code=0 | ||
args: --config ./golangcilint.yaml --exclude-files ./pkg/verity/verity.go --enable-all ./cmd/... ./pkg/... | ||
|
||
# Optional: show only new issues if it's a pull request. The default value is `false`. | ||
# only-new-issues: true | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/go/pkg. | ||
# skip-pkg-cache: true | ||
# skip-pkg-cache: false | ||
|
||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build. | ||
# skip-build-cache: true | ||
- name: Run linter from make target | ||
run: | | ||
make check | ||
- name: Run log linter | ||
run: | | ||
make check-logs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
run: | ||
timeout: 60m | ||
|
||
linters: | ||
enable-all: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you feel about not tweaking these? While I don't some of the defaults, it might be easier than keeping a list of what we don't want? |
||
disable: | ||
- gomnd | ||
- funlen | ||
- gocognit | ||
- paralleltest | ||
- forbidigo | ||
- ireturn | ||
- wrapcheck | ||
- exhaustive | ||
- maintidx | ||
- exhaustruct | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- revive | ||
- musttag | ||
- depguard | ||
- execinquery | ||
- inamedparam | ||
- intrange | ||
- promlinter | ||
- protogetter | ||
- contextcheck # needs to revisit: https://github.com/project-zot/zot/pull/2556 | ||
- copyloopvar # needs to revisit: https://github.com/project-zot/zot/pull/2556 | ||
- typecheck | ||
- exportloopref | ||
|
||
linters-settings: | ||
dupl: | ||
threshold: 200 | ||
nestif: | ||
min-complexity: 26 | ||
cyclop: | ||
max-complexity: 40 | ||
skip-tests: true | ||
varnamelen: | ||
check-return: true | ||
ignore-type-assert-ok: true | ||
ignore-map-index-ok: true | ||
ignore-chan-recv-ok: true | ||
ignore-names: | ||
- err | ||
- ok | ||
- gc | ||
- wg | ||
ignore-decls: | ||
- n int | ||
- i int | ||
- r *os.File | ||
- w *os.File | ||
- to int64 | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
wsl: | ||
allow-assign-and-anything: true | ||
force-err-cuddling: true | ||
nolintlint: | ||
allow-unused: true | ||
mnd: | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- operation | ||
- return | ||
- assign | ||
ignored-numbers: | ||
- "10" | ||
- "64" |
Oops, something went wrong.
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.
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.
Could you comment on excluding verity.go ?
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.
Ah, I see below related to cgo ... can we add that comment to the lint.yaml so we remember why?