-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jhoward-lm/golangci-lint-config
ci: add golangci-lint config and workflow
- Loading branch information
Showing
5 changed files
with
226 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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,49 @@ | ||
# ------------------------------------------------------------------------ | ||
# SPDX-FileCopyrightText: Copyright © 2024 The Protobom Authors | ||
# SPDX-FileType: SOURCE | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# ------------------------------------------------------------------------ | ||
# This workflow uses actions that are not certified by | ||
# GitHub. They are provided by a third-party and are | ||
# governed by separate terms of service, privacy policy, | ||
# and support documentation. | ||
# ------------------------------------------------------------------------ | ||
--- | ||
name: golangci-lint | ||
|
||
on: | ||
pull_request: | ||
branches: main | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
checks: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version-file: go.mod | ||
cache: false | ||
|
||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@82d40c283aeb1f2b6595839195e95c2d6a49081b # v5.0.0 | ||
with: | ||
install-mode: goinstall | ||
version: cd890db217def69d68cf1862504bb735c0333879 # v1.57.1 |
This file contains 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,170 @@ | ||
# ------------------------------------------------------------------------ | ||
# SPDX-FileCopyrightText: Copyright © 2024 The Protobom Authors | ||
# SPDX-FileType: SOURCE | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# ------------------------------------------------------------------------ | ||
--- | ||
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json | ||
|
||
run: | ||
concurrency: 6 | ||
go: "1.22.0" | ||
timeout: 5m | ||
|
||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- funlen | ||
- goconst | ||
- gocyclo | ||
|
||
# Maximum issues count per one linter. | ||
# Set to 0 to disable. | ||
# Default: 50 | ||
max-issues-per-linter: 0 | ||
|
||
# Maximum count of issues with the same text. | ||
# Set to 0 to disable. | ||
# Default: 3 | ||
max-same-issues: 0 | ||
|
||
new-from-rev: "" | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- cyclop | ||
- dogsled | ||
- dupl | ||
- durationcheck | ||
- errcheck | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- forbidigo | ||
- forcetypeassert | ||
- funlen | ||
- gci | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- godox | ||
- goerr113 | ||
- gofmt | ||
- gofumpt | ||
- goheader | ||
- goimports | ||
- gomnd | ||
- gomoddirectives | ||
- gomodguard | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- lll | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nlreturn | ||
- noctx | ||
- nolintlint | ||
- paralleltest | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- tagliatelle | ||
- testpackage | ||
- thelper | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- wastedassign | ||
- whitespace | ||
- wrapcheck | ||
- wsl | ||
|
||
linters-settings: | ||
errcheck: | ||
check-type-assertions: true | ||
check-blank: true | ||
|
||
exhaustive: | ||
# https://golangci-lint.run/usage/linters/#exhaustive | ||
default-signifies-exhaustive: true | ||
|
||
govet: | ||
enable: | ||
- fieldalignment | ||
|
||
godox: | ||
keywords: | ||
- BUG | ||
- FIXME | ||
- HACK | ||
|
||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- prefix(github.com/protobom/storage) | ||
|
||
gocritic: | ||
enabled-checks: | ||
# Diagnostic | ||
- commentedOutCode | ||
- nilValReturn | ||
- sloppyReassign | ||
- weakCond | ||
- octalLiteral | ||
|
||
# Performance | ||
- appendCombine | ||
- equalFold | ||
- hugeParam | ||
- indexAlloc | ||
- rangeExprCopy | ||
- rangeValCopy | ||
|
||
# Style | ||
- boolExprSimplify | ||
- commentedOutImport | ||
- docStub | ||
- emptyFallthrough | ||
- emptyStringTest | ||
- hexLiteral | ||
- methodExprCall | ||
- stringXbytes | ||
- typeAssertChain | ||
- unlabelStmt | ||
- yodaStyleExpr | ||
|
||
# Opinionated | ||
- builtinShadow | ||
- importShadow | ||
- initClause | ||
- nestingReduce | ||
- paramTypeCombine | ||
- ptrToRefParam | ||
- typeUnparen | ||
- unnamedResult | ||
- unnecessaryBlock | ||
|
||
nolintlint: | ||
allow-unused: false | ||
require-specific: true |
This file contains 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
This file contains 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
This file contains 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