-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1002 - add "checkPublicInterface" option to "exported" rule to allow check documentation on public methods on public interfaces #1003
Conversation
…onst [var-naming] handle private uppercased const
…ule - to check public interface method comments
Hi @comdiv. Are you still working in the PR? (some tests are not passing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a few things. Maybe you could consider them
@chavacava I'm ready to merge when you also approve. |
if iface, ok := v.Type.(*ast.InterfaceType); ok { | ||
if ast.IsExported(v.Name.Name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd maybe change it to
if iface, ok := v.Type.(*ast.InterfaceType); ok { | |
if ast.IsExported(v.Name.Name) { | |
if ast.IsExported(v.Name.Name) { | |
if iface, ok := v.Type.(*ast.InterfaceType); ok { |
This is to avoid preliminary type assertions for non-exported symbols.
P.S. And if so, two outer ifs would be possible to join as a single if (if w.checkPublicInterface && ast.IsExported(v.Name.Name)
).
flagStr, ok := flag.(string) | ||
if !ok { | ||
panic(fmt.Sprintf("Invalid argument for the %s rule: expecting a string, got %T", r.Name(), flag)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the switch/case below can work without this assertion (it can compare flag
to case values directly).
|
||
type somePrivate interface { | ||
AllGood() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit (add a new line)
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (few nits though)
Feature implementation for #1002