Skip to content

Commit

Permalink
ST1021: handle type names that are also articles
Browse files Browse the repository at this point in the history
Closes gh-1187
  • Loading branch information
dominikh committed Apr 23, 2022
1 parent 971b654 commit 416f0a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stylecheck/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,11 @@ func CheckExportedTypeDocs(pass *analysis.Pass) (interface{}, error) {
}
}

// Check comment before we strip articles in case the type's name is an article.
if strings.HasPrefix(text, node.Name.Name+" ") {
return false
}

s := text
articles := [...]string{"A", "An", "The"}
for _, a := range articles {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ type T13 struct{}
//some:directive //@ diag(`comment on exported type`)
// Whatever
type T14 struct{}

// A does stuff.
type A struct{}

0 comments on commit 416f0a8

Please sign in to comment.