Skip to content

Commit

Permalink
fix(workflows/publish): use --new and --new-from-rev
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneM committed Feb 13, 2024
1 parent e2952f4 commit bb7d7b4
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ jobs:
check-latest: true
- uses: golangci/golangci-lint-action@v3
with:
only-new-issues: false
# This flag is not working (https://github.com/golangci/golangci-lint-action/issues/531).
# We rather decided to use the suggestion from the FAQ (https://golangci-lint.run/usage/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues) and use `--new` and `--new-from-rev`
# only-new-issues: false
args: "--config=${{ github.action_path }}/.golangci.yml --new --new-from-rev=HEAD~1"

tests:
name: Unit Tests
Expand Down
137 changes: 137 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# This configuration file is based on the file used at GitLab:
# https://gitlab.com/gitlab-org/language-tools/go/linters/goargs/-/blob/master/.golangci.yml
run:
timeout: 2m
issues-exit-code: 1
modules-download-mode: vendor
# tests files are also analyzed
tests: true
skip-dirs:
- vendor

output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true

# Allow list of enabled linters
linters:
disable-all: true
# only execute the fast linters
fast: false
enable:
- bodyclose
- dogsled
- errcheck
- execinquery
- goconst
- gocritic
- goimports
- revive
- goprintffuncname
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- nonamedreturns
- nosprintfhostport
- staticcheck
- nestif
- typecheck
- unconvert
- unparam
- whitespace
- containedctx
- errchkjson
- contextcheck
- tenv
- reassign

issues:
# prevent some false positives by using the default list of excluded pattern
exclude-use-default: true
exclude-rules:
# Exclude contextcheck linter on test files
- path: '(.+)_test\.go'
linters:
- contextcheck

severity:
# the severity only impacts the output for some format (e.g. json)
default-severity: error

linters-settings:
errcheck:
check-type-assertions: true
# errcheck does not need to check the following functions as they are handled by errchkjson
exclude-functions:
- encoding/json.Marshal
- encoding/json.MarshalIndent
- (*encoding/json.Encoder).Encode
errchkjson:
check-error-free-encoding: true
report-no-exported: true
goimports:
local-prefixes: github.com/Scalingo
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-checks:
- appendCombine
- badCall
- badCond
- boolExprSimplify
- codegenComment
- commentFormatting
- commentedOutCode
- deprecatedComment
- dupImport
- emptyFallthrough
- emptyStringTest
- equalFold
- evalOrder
- exitAfterDefer
- flagName
- hexLiteral
- indexAlloc
- initClause
- methodExprCall
- nestingReduce
- newDeref
- nilValReturn
- offBy1
- ptrToRefParam
- rangeExprCopy
- regexpPattern
- sloppyReassign
- stringXbytes
- truncateCmp
- typeAssertChain
- typeUnparen
- underef
- unnecessaryBlock
- valSwap
- weakCond
- wrapperFunc
- yodaStyleExpr
gocyclo:
min-complexity: 10
govet:
check-shadowing: false
settings:
printf:
funcs:
- (github.com/sirupsen/logrus.FieldLogger).Errorf
- (github.com/sirupsen/logrus.FieldLogger).Error
- (github.com/sirupsen/logrus.FieldLogger).Warnf
- (github.com/sirupsen/logrus.FieldLogger).Warn
- (github.com/sirupsen/logrus.FieldLogger).Infof
- (github.com/sirupsen/logrus.FieldLogger).Info
- (github.com/sirupsen/logrus.FieldLogger).Debugf
- (github.com/sirupsen/logrus.FieldLogger).Debug
- (github.com/Scalingo/go-scalingo/v6/debug).Printf
- (github.com/Scalingo/go-scalingo/v6/debug).Println
nestif:
min-complexity: 7

0 comments on commit bb7d7b4

Please sign in to comment.