Skip to content

Commit e592777

Browse files
committed
Updated linter (and added config)
1 parent e247c87 commit e592777

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

.github/workflows/pr-workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Golang CI Lint
3737
uses: golangci/golangci-lint-action@v8
3838
with:
39-
version: v2.0.1
39+
version: v2.1.6
4040
args: --timeout 10m
4141

4242
unit-tests:

.golangci.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
version: "2"
2+
linters:
3+
enable:
4+
- bodyclose
5+
- containedctx
6+
- contextcheck
7+
- errorlint
8+
- goconst
9+
- godot
10+
- importas
11+
- nilerr
12+
- promlinter
13+
- revive
14+
- sloglint
15+
- testifylint
16+
- unparam
17+
- usestdlibvars
18+
settings:
19+
importas:
20+
alias:
21+
- pkg: ^k8s\.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)$
22+
alias: $1$2
23+
revive:
24+
rules:
25+
- name: exported
26+
exclusions:
27+
generated: lax
28+
presets:
29+
- comments
30+
- common-false-positives
31+
- legacy
32+
- std-error-handling
33+
paths:
34+
- generated.*\.go$
35+
- third_party$
36+
- builtin$
37+
- examples$
38+
formatters:
39+
enable:
40+
- gci
41+
- gofmt
42+
- goimports
43+
settings:
44+
gci:
45+
sections:
46+
- standard # Standard section: captures all standard packages.
47+
- default # Default section: contains all imports that could not be matched to another section type.
48+
- prefix(github.com/qdrant) # Custom section: groups all imports with the specified Prefix (our company, but our own component).
49+
- prefix(github.com/qdrant/terraform-provider-buf-plugin/) # Custom section: groups all imports with the specified Prefix (this component).
50+
exclusions:
51+
generated: lax
52+
paths:
53+
- generated.*\.go$
54+
- third_party$
55+
- builtin$
56+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
3838
GCI = $(LOCALBIN)/gci
3939

4040
## Tool Versions
41-
GOLANGCI_LINT_VERSION ?= v2.0.1
41+
GOLANGCI_LINT_VERSION ?= v2.1.6
4242
GCI_VERSION ?= v0.13.5
4343

4444
.PHONY: bootstrap

cmd/buf-plugin-required-fields/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func getRequiredEntityFields(request check.Request) ([]string, error) {
137137

138138
// extractEntityNames returns a set of entity names inferred from the name of
139139
// the service methods.
140-
// e.g: [ListBooks, GetBook] -> {Book}
140+
// e.g: [ListBooks, GetBook] -> {Book}.
141141
func extractEntityNames(fileDescriptor descriptor.FileDescriptor) map[string]struct{} {
142142
entityNames := make(map[string]struct{})
143143
services := fileDescriptor.FileDescriptorProto().GetService()
@@ -152,7 +152,7 @@ func extractEntityNames(fileDescriptor descriptor.FileDescriptor) map[string]str
152152
return entityNames
153153
}
154154

155-
// inferEntityFromMethodName extracts the entity name by stripping CRUD prefixes
155+
// inferEntityFromMethodName extracts the entity name by stripping CRUD prefixes.
156156
func inferEntityFromMethodName(methodName string) string {
157157
p := pluralize.NewClient()
158158
for _, prefix := range crudMethodPrefixes {

0 commit comments

Comments
 (0)