feat: linting
This commit is contained in:
parent
0414cf6dfb
commit
5b938091d7
2 changed files with 103 additions and 7 deletions
20
.github/workflows/release.yml
vendored
20
.github/workflows/release.yml
vendored
|
|
@ -16,11 +16,16 @@ jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: stackit-docker
|
runs-on: stackit-docker
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: CI checkout
|
||||||
- uses: actions/setup-go@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup GO
|
||||||
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: 1.26
|
go-version: 1.26
|
||||||
- uses: golangci/golangci-lint-action@v3
|
|
||||||
|
- name: GO Linting
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
|
||||||
# build:
|
# build:
|
||||||
# runs-on: stackit-docker
|
# runs-on: stackit-docker
|
||||||
|
|
@ -40,9 +45,11 @@ jobs:
|
||||||
runs-on: stackit-docker
|
runs-on: stackit-docker
|
||||||
# needs: build
|
# needs: build
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- uses: go-semantic-release/action@v1
|
- name: Semantic Release
|
||||||
|
uses: go-semantic-release/action@v1
|
||||||
id: semrel
|
id: semrel
|
||||||
with:
|
with:
|
||||||
github-token: ${{ env.FORGEJO_TOKEN }}
|
github-token: ${{ env.FORGEJO_TOKEN }}
|
||||||
|
|
@ -51,8 +58,7 @@ jobs:
|
||||||
changelog-file: CHANGELOG.md
|
changelog-file: CHANGELOG.md
|
||||||
changelog-generator-opt: "emojis=true"
|
changelog-generator-opt: "emojis=true"
|
||||||
|
|
||||||
-
|
- name: Login to Docker Hub
|
||||||
name: Login to Docker Hub
|
|
||||||
if: steps.semrel.outputs.version != ''
|
if: steps.semrel.outputs.version != ''
|
||||||
uses: docker/login-action@v4
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
90
.golang-ci.yaml
Normal file
90
.golang-ci.yaml
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
version: "2"
|
||||||
|
run:
|
||||||
|
concurrency: 4
|
||||||
|
output:
|
||||||
|
formats:
|
||||||
|
text:
|
||||||
|
print-linter-name: true
|
||||||
|
print-issued-lines: true
|
||||||
|
colors: true
|
||||||
|
path: stdout
|
||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- bodyclose
|
||||||
|
- depguard
|
||||||
|
- errorlint
|
||||||
|
- forcetypeassert
|
||||||
|
- gochecknoinits
|
||||||
|
- gocritic
|
||||||
|
- gosec
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- revive
|
||||||
|
- sqlclosecheck
|
||||||
|
- wastedassign
|
||||||
|
disable:
|
||||||
|
- noctx
|
||||||
|
- unparam
|
||||||
|
settings:
|
||||||
|
depguard:
|
||||||
|
rules:
|
||||||
|
main:
|
||||||
|
list-mode: original
|
||||||
|
allow: []
|
||||||
|
deny:
|
||||||
|
- pkg: github.com/stretchr/testify
|
||||||
|
desc: Do not use a testing framework
|
||||||
|
gocritic:
|
||||||
|
disabled-checks:
|
||||||
|
- wrapperFunc
|
||||||
|
- typeDefFirst
|
||||||
|
- ifElseChain
|
||||||
|
- dupImport
|
||||||
|
- hugeParam
|
||||||
|
enabled-tags:
|
||||||
|
- performance
|
||||||
|
- style
|
||||||
|
- experimental
|
||||||
|
gosec:
|
||||||
|
excludes:
|
||||||
|
- G104
|
||||||
|
- G102
|
||||||
|
- G304
|
||||||
|
- G307
|
||||||
|
misspell:
|
||||||
|
locale: US
|
||||||
|
nakedret:
|
||||||
|
max-func-lines: 0
|
||||||
|
revive:
|
||||||
|
severity: error
|
||||||
|
rules:
|
||||||
|
- name: errorf
|
||||||
|
- name: context-as-argument
|
||||||
|
- name: error-return
|
||||||
|
- name: increment-decrement
|
||||||
|
- name: indent-error-flow
|
||||||
|
- name: superfluous-else
|
||||||
|
- name: unused-parameter
|
||||||
|
- name: unreachable-code
|
||||||
|
- name: atomic
|
||||||
|
- name: empty-lines
|
||||||
|
- name: early-return
|
||||||
|
exclusions:
|
||||||
|
paths:
|
||||||
|
- generator/
|
||||||
|
- internal/testutils
|
||||||
|
generated: lax
|
||||||
|
warn-unused: true
|
||||||
|
# Excluding configuration per-path, per-linter, per-text and per-source.
|
||||||
|
rules:
|
||||||
|
# Exclude some linters from running on tests files.
|
||||||
|
- path: _test\.go
|
||||||
|
linters:
|
||||||
|
- gochecknoinits
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
# settings:
|
||||||
|
# goimports:
|
||||||
|
# local-prefixes:
|
||||||
Loading…
Add table
Add a link
Reference in a new issue