Skip to content

Commit b512c36

Browse files
committed
chore: add new rule
1 parent f91e0f3 commit b512c36

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.golangci.next.reference.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,12 @@ linters-settings:
16121612
arguments:
16131613
- mypragma
16141614
- otherpragma
1615+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comments-density
1616+
- name: comments-density
1617+
severity: warning
1618+
disabled: false
1619+
exclude: [""]
1620+
arguments: [ 15 ]
16151621
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
16161622
- name: confusing-naming
16171623
severity: warning

jsonschema/golangci.next.jsonschema.json

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@
217217
"call-to-gc",
218218
"cognitive-complexity",
219219
"comment-spacings",
220+
"comments-density",
220221
"confusing-naming",
221222
"confusing-results",
222223
"constant-logical-expr",

pkg/golinters/revive/revive.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func safeTomlSlice(r []any) []any {
275275
}
276276

277277
// This element is not exported by revive, so we need copy the code.
278-
// Extracted from https://github.com/mgechev/revive/blob/v1.3.7/config/config.go#L15
278+
// Extracted from https://github.com/mgechev/revive/blob/v1.3.9/config/config.go#L15
279279
var defaultRules = []lint.Rule{
280280
&rule.VarDeclarationsRule{},
281281
&rule.PackageCommentsRule{},
@@ -358,6 +358,7 @@ var allRules = append([]lint.Rule{
358358
&rule.EnforceRepeatedArgTypeStyleRule{},
359359
&rule.EnforceSliceStyleRule{},
360360
&rule.MaxControlNestingRule{},
361+
&rule.CommentsDensityRule{},
361362
}, defaultRules...)
362363

363364
const defaultConfidence = 0.8

0 commit comments

Comments
 (0)