Skip to content
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

cicd: enable all linters #31

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 32 additions & 49 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# options for analysis running
run:
# Select the Go version to target. The default is '1.13'.
go: "1.22"

# default concurrency is a available CPU number
concurrency: 4

Expand All @@ -15,30 +18,6 @@ run:
# list of build tags, all linters use it. Default is empty list.
build-tags: []

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- generated
- ".*mock(s)?.*"

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-files:
- '.*mock.*\.go'
- '.*\.gen\.go'

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand All @@ -56,9 +35,21 @@ run:

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
format: colored-line-number
# The formats used to render issues.
# Format: `colored-line-number`, `line-number`, `json`, `colored-tab`, `tab`, `checkstyle`, `code-climate`, `junit-xml`, `github-actions`, `teamcity`
# Output path can be either `stdout`, `stderr` or path to the file to write to.
#
# For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
# The output can be specified for each of them by separating format name and path by colon symbol.
# Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
# The CLI flag (`--out-format`) override the configuration file.
#
# Default:
# formats:
# - format: colored-line-number
# path: stdout
formats:
- format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true
Expand Down Expand Up @@ -143,7 +134,7 @@ linters-settings:

govet:
# report about shadowed variables
check-shadowing: true
shadow: true

# settings per analyzer
settings:
Expand Down Expand Up @@ -173,8 +164,6 @@ linters-settings:
q: false

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.22"
# https://staticcheck.io/docs/options#checks
checks: [ "all" ]

Expand All @@ -185,10 +174,6 @@ linters-settings:
# with golangci-lint call it on a directory with the changed file.
check-exported: false

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.22"

dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
Expand Down Expand Up @@ -233,8 +218,6 @@ linters-settings:
local-prefixes: github.com/titusjaka

gosimple:
# Select the Go version to target. The default is '1.13'.
go: "1.22"
# https://staticcheck.io/docs/options#checks
checks: [ "all" ]

Expand Down Expand Up @@ -264,12 +247,10 @@ linters:
- cyclop
- durationcheck
- errcheck
# TODO (titusjaka): enable when I update packages
# - errorlint
- errorlint
- exportloopref
- forbidigo
# TODO (titusjaka): enable when I get rid of gokit
# - forcetypeassert
- forcetypeassert
- gocognit
- gofmt
- gosec
Expand All @@ -280,10 +261,9 @@ linters:
- typecheck
- unparam
- unused
# TODO (titusjaka): enable when I get rid of gokit
# - contextcheck
# - dupl
# - sloglint
- contextcheck
- dupl
- sloglint
- errname
- exhaustive
- funlen
Expand All @@ -307,6 +287,14 @@ issues:
# excluded by default patterns execute `golangci-lint run --help`
exclude: []

exclude-dirs:
- generated
- ".*mock(s)?.*"

exclude-files:
- '.*mock.*\.go'
- '.*\.gen\.go'

# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
Expand Down Expand Up @@ -344,11 +332,6 @@ issues:
# We need to suppress it in tests for helper functions purpose.
text: G107

# TODO (titusjaka): remove this exclusion in future
- path: _test\.go
linters:
- govet

# Independently of option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
Expand Down
Loading