Skip to content

Commit 3cebab9

Browse files
babakksldez
andauthored
build(deps): bump github.com/godoc-lint/godoc-lint from 0.10.2 to 0.11.1 (#6282)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 6a55b8b commit 3cebab9

File tree

10 files changed

+48
-17
lines changed

10 files changed

+48
-17
lines changed

.golangci.next.reference.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,9 @@ linters:
13201320
# Assert no unused link in godocs.
13211321
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#no-unused-link
13221322
- no-unused-link
1323+
# Require proper doc links to standard library declarations where applicable.
1324+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#require-stdlib-doclink
1325+
- require-stdlib-doclink
13231326

13241327
# List of rules to disable.
13251328
# Default: empty
@@ -1332,12 +1335,13 @@ linters:
13321335
- deprecated
13331336
- max-len
13341337
- no-unused-link
1338+
- require-stdlib-doclink
13351339

13361340
# A map for fine-tuning individual rules.
13371341
# All subkeys are optional.
13381342
options:
13391343
max-len:
1340-
# Maximum line length for godocs, not including the `// `, or `/*` or `*/` tokens.
1344+
# Maximum line length for godocs, not including the `//`, `/*` or `*/` tokens.
13411345
# Default: 77
13421346
length: 127
13431347

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ require (
4848
github.com/go-critic/go-critic v0.14.2
4949
github.com/go-viper/mapstructure/v2 v2.4.0
5050
github.com/go-xmlfmt/xmlfmt v1.1.3
51-
github.com/godoc-lint/godoc-lint v0.10.2
51+
github.com/godoc-lint/godoc-lint v0.11.1
5252
github.com/gofrs/flock v0.13.0
5353
github.com/golangci/asciicheck v0.5.0
5454
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,8 @@
487487
"require-doc",
488488
"deprecated",
489489
"max-len",
490-
"no-unused-link"
490+
"no-unused-link",
491+
"require-stdlib-doclink"
491492
]
492493
},
493494
"gosec-rules": {
@@ -1937,7 +1938,7 @@
19371938
"properties": {
19381939
"length": {
19391940
"type": "integer",
1940-
"description": "Maximum line length for godocs, not including the `// `, or `/*` or `*/` tokens.",
1941+
"description": "Maximum line length for godocs, not including the `//`, `/*` or `*/` tokens.",
19411942
"default": 77
19421943
}
19431944
}

pkg/golinters/godoclint/godoclint.go

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,35 @@ func New(settings *config.GodoclintSettings) *goanalysis.Linter {
3535
// - Options.RequireDocIncludeTests
3636
// - Options.StartWithNameIncludeTests
3737
// - Options.NoUnusedLinkIncludeTests
38+
// - Options.RequireStdlibDoclinkIncludeTests
39+
40+
// Also, Options.MaxLenIgnorePatterns is ignored because the Golangci-lint's idiomatic way to ignore such issues
41+
// is exclusion by source text patterns.
3842

3943
pcfg = glconfig.PlainConfig{
4044
Default: settings.Default,
4145
Enable: settings.Enable,
4246
Disable: settings.Disable,
4347
Options: &glconfig.PlainRuleOptions{
44-
MaxLenLength: settings.Options.MaxLen.Length,
45-
MaxLenIncludeTests: pointer(true),
46-
PkgDocIncludeTests: pointer(false),
47-
SinglePkgDocIncludeTests: pointer(true),
48-
RequirePkgDocIncludeTests: pointer(false),
49-
RequireDocIncludeTests: pointer(true),
50-
RequireDocIgnoreExported: settings.Options.RequireDoc.IgnoreExported,
51-
RequireDocIgnoreUnexported: settings.Options.RequireDoc.IgnoreUnexported,
52-
StartWithNameIncludeTests: pointer(false),
53-
StartWithNameIncludeUnexported: settings.Options.StartWithName.IncludeUnexported,
54-
NoUnusedLinkIncludeTests: pointer(true),
48+
MaxLenLength: settings.Options.MaxLen.Length,
49+
MaxLenIncludeTests: pointer(true),
50+
MaxLenIgnorePatterns: []string{`^\+kubebuilder:`},
51+
PkgDocIncludeTests: pointer(false),
52+
SinglePkgDocIncludeTests: pointer(true),
53+
RequirePkgDocIncludeTests: pointer(false),
54+
RequireDocIncludeTests: pointer(true),
55+
RequireDocIgnoreExported: settings.Options.RequireDoc.IgnoreExported,
56+
RequireDocIgnoreUnexported: settings.Options.RequireDoc.IgnoreUnexported,
57+
StartWithNameIncludeTests: pointer(false),
58+
StartWithNameIncludeUnexported: settings.Options.StartWithName.IncludeUnexported,
59+
RequireStdlibDoclinkIncludeTests: pointer(true),
60+
NoUnusedLinkIncludeTests: pointer(true),
5561
},
5662
}
63+
64+
if err := pcfg.Validate(); err != nil {
65+
internal.LinterLogger.Fatalf("godoclint: %v", err)
66+
}
5767
}
5868

5969
composition := glcompose.Compose(glcompose.CompositionConfig{

pkg/golinters/godoclint/testdata/godoclint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ linters:
1212
- deprecated
1313
- max-len
1414
- no-unused-link
15+
- require-stdlib-doclink
1516
options:
1617
start-with-name:
1718
include-unexported: true

pkg/golinters/godoclint/testdata/godoclint_default_pass.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ const DeprecatedConstB = 1
5656
//
5757
// DEPRECATED: invalid deprecation note but okay since the symbol is not exported
5858
const deprecatedConstC = 1
59+
60+
// constWithStdlibDoclink has a potential doc link to encoding/json.Encoder but
61+
// should be ignored since the rule is not enabled by default.
62+
const constWithStdlibDoclink = 1

pkg/golinters/godoclint/testdata/godoclint_full_fail.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,8 @@ const DeprecatedConstB = 1
105105
//
106106
// deprecated:do not use
107107
const DeprecatedConstC = 1
108+
109+
// constWithStdlibDoclink has a potential doc link to encoding/json.Encoder. // want `text "encoding/json\.Encoder" should be replaced with "\[encoding/json\.Encoder\]" to link to stdlib type`
110+
//
111+
//godoclint:disable max-len
112+
const constWithStdlibDoclink = 1

pkg/golinters/godoclint/testdata/godoclint_full_pass.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ const DeprecatedConstB = 1
7373
//
7474
// DEPRECATED: invalid deprecation note but okay since the symbol is not exported
7575
const deprecatedConstC = 1
76+
77+
// constWithStdlibDoclink has a doc link to [encoding/json.Encoder].
78+
const constWithStdlibDoclink = 1

pkg/golinters/godoclint/testdata/godoclint_full_pass_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ const DeprecatedConstA = 1
6868

6969
// Deprecated: do not use
7070
const DeprecatedConstB = 1
71+
72+
// constWithStdlibDoclink has a doc link to [encoding/json.Encoder].
73+
const constWithStdlibDoclink = 1

0 commit comments

Comments
 (0)