Skip to content

Commit 341fcac

Browse files
authored
Merge branch 'main' into add-gounqvet-linter
2 parents 23b4b5f + b7bd3db commit 341fcac

14 files changed

+680
-6
lines changed

.golangci.next.reference.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ linters:
5959
- goconst
6060
- gocritic
6161
- gocyclo
62+
- godoclint
6263
- godot
6364
- godox
6465
- goheader
@@ -172,6 +173,7 @@ linters:
172173
- goconst
173174
- gocritic
174175
- gocyclo
176+
- godoclint
175177
- godot
176178
- godox
177179
- goheader
@@ -1270,6 +1272,74 @@ linters:
12701272
# Default: 30 (but we recommend 10-20)
12711273
min-complexity: 10
12721274

1275+
godoclint:
1276+
# Default set of rules to enable.
1277+
# Possible values are: `basic`, `all` or `none`.
1278+
# Default: `basic` (enables `pkg-doc`, `single-pkg-doc`, `start-with-name`, and `deprecated`)
1279+
default: all
1280+
1281+
# List of rules to enable in addition to the default set.
1282+
# Default: empty
1283+
enable:
1284+
# Check proper package-level godoc, if any.
1285+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#pkg-doc
1286+
- pkg-doc
1287+
# Assert at most one godoc per package.
1288+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#single-pkg-doc
1289+
- single-pkg-doc
1290+
# Require all packages to have a godoc.
1291+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#require-pkg-doc
1292+
- require-pkg-doc
1293+
# Assert symbol godocs start with the symbol name.
1294+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#start-with-name
1295+
- start-with-name
1296+
# Require godoc for all public symbols.
1297+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#require-doc
1298+
- require-doc
1299+
# Assert correct formatting of deprecation notes.
1300+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#deprecated
1301+
- deprecated
1302+
# Assert maximum line length for godocs.
1303+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#max-len
1304+
- max-len
1305+
# Assert no unused link in godocs.
1306+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#no-unused-link
1307+
- no-unused-link
1308+
1309+
# List of rules to disable.
1310+
# Default: empty
1311+
disable:
1312+
- pkg-doc
1313+
- single-pkg-doc
1314+
- require-pkg-doc
1315+
- start-with-name
1316+
- require-doc
1317+
- deprecated
1318+
- max-len
1319+
- no-unused-link
1320+
1321+
# A map for fine-tuning individual rules.
1322+
# All subkeys are optional.
1323+
options:
1324+
max-len:
1325+
# Maximum line length for godocs, not including the `// `, or `/*` or `*/` tokens.
1326+
# Default: 77
1327+
length: 127
1328+
1329+
require-doc:
1330+
# Ignore exported (public) symbols when applying the `require-doc` rule.
1331+
# Default: false
1332+
ignore-exported: true
1333+
1334+
# Ignore unexported (private) symbols when applying the `require-doc` rule.
1335+
# Default: true
1336+
ignore-unexported: false
1337+
1338+
start-with-name:
1339+
# Include unexported symbols when applying the `start-with-name` rule.
1340+
# Default: false
1341+
include-unexported: true
1342+
12731343
godot:
12741344
# Comments to be checked: `declarations`, `toplevel`, `noinline` or `all`.
12751345
# Default: declarations

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/AlwxSin/noinlineerr v1.0.5
1313
github.com/Antonboom/errname v1.1.1
1414
github.com/Antonboom/nilnil v1.1.1
15-
github.com/Antonboom/testifylint v1.6.3
15+
github.com/Antonboom/testifylint v1.6.4
1616
github.com/BurntSushi/toml v1.5.0
1717
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
1818
github.com/OpenPeeDeeP/depguard/v2 v2.2.1
@@ -46,6 +46,7 @@ require (
4646
github.com/go-critic/go-critic v0.13.0
4747
github.com/go-viper/mapstructure/v2 v2.4.0
4848
github.com/go-xmlfmt/xmlfmt v1.1.3
49+
github.com/godoc-lint/godoc-lint v0.10.0
4950
github.com/gofrs/flock v0.12.1
5051
github.com/golangci/asciicheck v0.5.0
5152
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32
@@ -114,7 +115,7 @@ require (
114115
github.com/ssgreg/nlreturn/v2 v2.2.1
115116
github.com/stbenjam/no-sprintf-host-port v0.2.0
116117
github.com/stretchr/testify v1.11.1
117-
github.com/tetafro/godot v1.5.1
118+
github.com/tetafro/godot v1.5.2
118119
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67
119120
github.com/timonwong/loggercheck v0.11.0
120121
github.com/tomarrell/wrapcheck/v2 v2.11.0

go.sum

Lines changed: 6 additions & 4 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: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,18 @@
477477
"-QF1012"
478478
]
479479
},
480+
"godoclint-rules": {
481+
"enum": [
482+
"pkg-doc",
483+
"single-pkg-doc",
484+
"require-pkg-doc",
485+
"start-with-name",
486+
"require-doc",
487+
"deprecated",
488+
"max-len",
489+
"no-unused-link"
490+
]
491+
},
480492
"gosec-rules": {
481493
"enum": [
482494
"G101",
@@ -795,6 +807,7 @@
795807
"goconst",
796808
"gocritic",
797809
"gocyclo",
810+
"godoclint",
798811
"godot",
799812
"godox",
800813
"err113",
@@ -1849,6 +1862,74 @@
18491862
}
18501863
}
18511864
},
1865+
"godoclintSettings": {
1866+
"type": "object",
1867+
"properties": {
1868+
"default": {
1869+
"type": "string",
1870+
"enum": ["all", "basic", "none"],
1871+
"default": "basic",
1872+
"description": "Default set of rules to enable."
1873+
},
1874+
"enable": {
1875+
"description": "List of rules to enable in addition to the default set.",
1876+
"type": "array",
1877+
"uniqueItems": true,
1878+
"items": {
1879+
"$ref": "#/definitions/godoclint-rules"
1880+
}
1881+
},
1882+
"disable": {
1883+
"description": "List of rules to disable.",
1884+
"type": "array",
1885+
"uniqueItems": true,
1886+
"items": {
1887+
"$ref": "#/definitions/godoclint-rules"
1888+
}
1889+
},
1890+
"options": {
1891+
"type": "object",
1892+
"description": "A map for setting individual rule options.",
1893+
"properties": {
1894+
"max-len": {
1895+
"type": "object",
1896+
"properties": {
1897+
"length": {
1898+
"type": "integer",
1899+
"description": "Maximum line length for godocs, not including the `// `, or `/*` or `*/` tokens.",
1900+
"default": 77
1901+
}
1902+
}
1903+
},
1904+
"require-doc": {
1905+
"type": "object",
1906+
"properties": {
1907+
"ignore-exported": {
1908+
"type": "boolean",
1909+
"description": "Ignore exported (public) symbols when applying the `require-doc` rule.",
1910+
"default": false
1911+
},
1912+
"ignore-unexported": {
1913+
"type": "boolean",
1914+
"description": "Ignore unexported (private) symbols when applying the `require-doc` rule.",
1915+
"default": true
1916+
}
1917+
}
1918+
},
1919+
"start-with-name": {
1920+
"type": "object",
1921+
"properties": {
1922+
"include-unexported": {
1923+
"type": "boolean",
1924+
"description": "Include unexported symbols when applying the `start-with-name` rule.",
1925+
"default": false
1926+
}
1927+
}
1928+
}
1929+
}
1930+
}
1931+
}
1932+
},
18521933
"godotSettings": {
18531934
"type": "object",
18541935
"additionalProperties": false,
@@ -4577,6 +4658,9 @@
45774658
"gocyclo": {
45784659
"$ref": "#/definitions/settings/definitions/gocycloSettings"
45794660
},
4661+
"godoclint": {
4662+
"$ref": "#/definitions/settings/definitions/godoclintSettings"
4663+
},
45804664
"godot": {
45814665
"$ref": "#/definitions/settings/definitions/godotSettings"
45824666
},

pkg/config/linters_settings.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ type LintersSettings struct {
245245
Goconst GoConstSettings `mapstructure:"goconst"`
246246
Gocritic GoCriticSettings `mapstructure:"gocritic"`
247247
Gocyclo GoCycloSettings `mapstructure:"gocyclo"`
248+
Godoclint GodoclintSettings `mapstructure:"godoclint"`
248249
Godot GodotSettings `mapstructure:"godot"`
249250
Godox GodoxSettings `mapstructure:"godox"`
250251
Goheader GoHeaderSettings `mapstructure:"goheader"`
@@ -525,6 +526,24 @@ type GoCycloSettings struct {
525526
MinComplexity int `mapstructure:"min-complexity"`
526527
}
527528

529+
type GodoclintSettings struct {
530+
Default *string `mapstructure:"default"`
531+
Enable []string `mapstructure:"enable"`
532+
Disable []string `mapstructure:"disable"`
533+
Options struct {
534+
MaxLen struct {
535+
Length *uint `mapstructure:"length"`
536+
} `mapstructure:"max-len"`
537+
RequireDoc struct {
538+
IgnoreExported *bool `mapstructure:"ignore-exported"`
539+
IgnoreUnexported *bool `mapstructure:"ignore-unexported"`
540+
} `mapstructure:"require-doc"`
541+
StartWithName struct {
542+
IncludeUnexported *bool `mapstructure:"include-unexported"`
543+
} `mapstructure:"start-with-name"`
544+
} `mapstructure:"options"`
545+
}
546+
528547
type GodotSettings struct {
529548
Scope string `mapstructure:"scope"`
530549
Exclude []string `mapstructure:"exclude"`

0 commit comments

Comments
 (0)