Skip to content

Commit 27ccfa2

Browse files
committed
add comments
Signed-off-by: dongjiang <[email protected]>
1 parent 4218937 commit 27ccfa2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ jobs:
3434
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # tag=v7.0.0
3535
with:
3636
version: v2.0.2
37-
args: --out-format=colored-line-number
37+
args: --output.text.print-linter-name=true --output.text.colors=true
38+
--out-format=colored-line-number
3839
working-directory: ${{matrix.working-directory}}

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ run:
44
modules-download-mode: readonly
55
allow-parallel-runners: true
66
linters:
7+
# sync from https://github.com/kubernetes-sigs/controller-runtime/blob/main/.golangci.yml
78
default: none
89
enable:
910
- asasalint
@@ -47,7 +48,10 @@ linters:
4748
importas:
4849
no-unaliased: true
4950
revive:
51+
# By default, revive will enable only the linting rules that are named in the configuration file.
52+
# So, it's needed to explicitly enable all required rules here.
5053
rules:
54+
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
5155
- name: blank-imports
5256
- name: context-as-argument
5357
- name: context-keys-type
@@ -68,6 +72,9 @@ linters:
6872
- name: superfluous-else
6973
- name: unreachable-code
7074
- name: redefines-builtin-id
75+
#
76+
# Rules in addition to the recommended configuration above.
77+
#
7178
- name: bool-literal-in-expr
7279
- name: constant-logical-expr
7380
exclusions:
@@ -78,11 +85,15 @@ linters:
7885
- legacy
7986
- std-error-handling
8087
rules:
88+
# Dot imports for gomega and ginkgo are allowed
89+
# within test files.
8190
- path: _test\.go
8291
text: should not use dot imports
92+
# Ignore error type switch case
8393
- linters:
8494
- errorlint
8595
path: pkg/loader/loader.go
96+
# Ignore test files
8697
- linters:
8798
- dupl
8899
- ginkgolinter
@@ -93,6 +104,7 @@ linters:
93104
- linters:
94105
- exhaustive
95106
path: pkg/markers/parse.go|pkg/deepcopy/traverse.go|pkg/genall/help/types.go|pkg/crd/schema.go|pkg/crd/flatten.go
107+
# Ignore consider pre-allocating variables
96108
- linters:
97109
- prealloc
98110
text: Consider pre-allocating

0 commit comments

Comments
 (0)