Skip to content

Commit

Permalink
refactor: move all golangci-lint options from GHA to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Victoremepunto committed Sep 5, 2024
1 parent 323a919 commit d6038fa
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 13 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,18 @@ jobs:
name: Checkout frontend-operator

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
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: latest

args: >
--enable=errcheck,gocritic,gofmt,goimports,gosec,gosimple,govet,ineffassign,revive,staticcheck,typecheck,unused,bodyclose
--fix=false
--max-same-issues=20
--out-${NO_FUTURE}format=colored-line-number
--print-issued-lines=true
--print-linter-name=true
--sort-results=true
--timeout=5m0s
--uniq-by-line=false
# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: false
# only-new-issues: false

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
Expand Down
69 changes: 69 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,75 @@
linters:
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- errcheck
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- revive
- staticcheck
- typecheck
- unused
- bodyclose
issues:
exclude-rules:
- path: api/v1alpha1/groupversion_info.go
linters:
- gofmt
- goimports
# Fix found issues (if it's supported by the linter).
# Default: false
# fix: true

# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 20

output:
# The formats used to render issues.
# Formats:
# - `colored-line-number`
# - `line-number`
# - `json`
# - `colored-tab`
# - `tab`
# - `html`
# - `checkstyle`
# - `code-climate`
# - `junit-xml`
# - `github-actions`
# - `teamcity`
# - `sarif`
# 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
# Print lines of code with issue.
# Default: true
# print-issued-lines: false
# Print linter name in the end of issue text.
# Default: true
# print-linter-name: false
# Sort results by the order defined in `sort-order`.
# Default: false
sort-results: true
# Make issues output unique by line.
# Default: true
uniq-by-line: false

run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m

0 comments on commit d6038fa

Please sign in to comment.