1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-29 22:28:23 +02:00

fix(#1363): package-comments ignores //nolint directives (#1366)

This commit is contained in:
chavacava
2025-05-23 14:07:38 +02:00
committed by GitHub
parent 3cac850cb6
commit f531af3b48
2 changed files with 7 additions and 1 deletions

View File

@@ -143,7 +143,7 @@ func (l *lintPackageComments) Visit(_ ast.Node) ast.Visitor {
}
}
if l.fileAst.Doc == nil {
if isEmptyDoc(l.fileAst.Doc) {
for _, failure := range l.checkPackageComment() {
l.onFailure(failure)
}
@@ -162,3 +162,7 @@ func (l *lintPackageComments) Visit(_ ast.Node) ast.Visitor {
}
return nil
}
func isEmptyDoc(commentGroup *ast.CommentGroup) bool {
return commentGroup == nil || commentGroup.Text() == ""
}

2
testdata/golint/package_doc7.go vendored Normal file
View File

@@ -0,0 +1,2 @@
//nolint:dupl
package foo