Skip to content

Commit

Permalink
switch to crossplane/build & consume golangci-linter 1.61.0
Browse files Browse the repository at this point in the history
Signed-off-by: Erhan Cagirici <[email protected]>
  • Loading branch information
erhancagirici authored and turkenf committed Feb 11, 2025
1 parent c206eb1 commit a0524a0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 33 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
# SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

Expand Down Expand Up @@ -99,8 +99,9 @@ jobs:
- name: Lint
env:
GOLANGCI_LINT_CACHE: ${{ steps.go_cache.outputs.analysis_cache }}
SKIP_LINTER_ANALYSIS: true
RUN_BUILDTAGGER: false
SKIP_LINTER_ANALYSIS: false
RUN_BUILDTAGGER: true
GOGC: "50"
run: make lint

check-diff:
Expand Down Expand Up @@ -226,4 +227,4 @@ jobs:

- name: Check Example Manifests
run: |
./scripts/check-examples.py package/crds examples
./scripts/check-examples.py package/crds examples
50 changes: 22 additions & 28 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
# SPDX-License-Identifier: CC0-1.0

run:
timeout: 10m
timeout: 90m
concurrency: 1

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
formats:
- format: colored-line-number
print-linter-name: true

linters-settings:
errcheck:
Expand All @@ -20,11 +22,10 @@ linters-settings:
# default is false: such cases aren't reported by default.
check-blank: false

# [deprecated] comma-separated list of pairs of the form pkg:regex
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
exclude-files:
- fmt:.*,io/ioutil:^Read.*
exclude-functions:
- io/ioutil.ReadFile
- io/ioutil.ReadDir
- io/ioutil.ReadAll

govet:
# report about shadowed variables
Expand All @@ -47,10 +48,6 @@ linters-settings:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10

maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true

dupl:
# tokens count to trigger issue, 150 by default
threshold: 100
Expand All @@ -65,13 +62,6 @@ linters-settings:
# tab width in spaces. Default to 1.
tab-width: 1

unused:
# treat code as a program (not a library) and report unused exported identifiers; default is false.
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false

unparam:
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
Expand Down Expand Up @@ -127,12 +117,16 @@ linters:
- unused
fast: false


issues:
exclude-files:
- "zz_\\..+\\.go$"
- "zz_.*go$"
# Excluding configuration per-path and per-linter
exclude-rules:
# some group names we have (like "hdinsight") make this linter
# unhappy, so just disable the "misspell" linter on generated files.
- path: zz_.+\.go$
linters:
- misspell
# Exclude some linters from running on tests files.
- path: _test(ing)?\.go
linters:
Expand All @@ -154,31 +148,31 @@ issues:
# rather than using a pointer.
- text: "(hugeParam|rangeValCopy):"
linters:
- gocritic
- gocritic

# This "TestMain should call os.Exit to set exit code" warning is not clever
# enough to notice that we call a helper method that calls os.Exit.
- text: "SA3000:"
linters:
- staticcheck
- staticcheck

- text: "k8s.io/api/core/v1"
linters:
- goimports
- goimports

# This is a "potential hardcoded credentials" warning. It's triggered by
# any variable with 'secret' in the same, and thus hits a lot of false
# positives in Kubernetes land where a Secret is an object type.
- text: "G101:"
linters:
- gosec
- gas
- gosec
- gas

# This is an 'errors unhandled' warning that duplicates errcheck.
- text: "G104:"
linters:
- gosec
- gas
- gosec
- gas

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
Expand All @@ -195,7 +189,7 @@ issues:
new: false

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-per-linter: 0
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0
max-same-issues: 0
2 changes: 1 addition & 1 deletion build

0 comments on commit a0524a0

Please sign in to comment.