Skip to content
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

exported: report differently a method that is now exported #1235

Open
ccoVeille opened this issue Feb 12, 2025 · 2 comments
Open

exported: report differently a method that is now exported #1235

ccoVeille opened this issue Feb 12, 2025 · 2 comments

Comments

@ccoVeille
Copy link
Contributor

ccoVeille commented Feb 12, 2025

package sandbox

// Foo is OK
func Foo() {}

// fooBarQuux was not exported but is now exported
func FooBarQuux() {}

Image

revive reports the right things yet, but it could be improved.

Here we are 100% sure the issue is the fact the method is now exported, but wasn't before

But because golangci-lint exclude EXC0012 by default.
This one is not reported via golangci-lint.

We should consider trying to detect it, and report another message that won't be caught by EXC0012

Here the idea is to compare that only the case of the first letter differ.

Please note #1235 is a special case of #1236

@chavacava
Copy link
Collaborator

@ccoVeille what message could we report for these cases?

@ccoVeille
Copy link
Contributor Author

Let's consider #1236 with this issue for providing a wording.

So we already have this error messages

  • exported (.+) should have comment( (or a comment on this block))? or be unexported

  • comment on exported (.+) should be of the form "(.+)..."

  • package comment should be of the form "(.+)..."

  • should have a package comment

These are respectively, exc0012, exc0013, exc0014, exc0015

Here are some suggestions:

  • invalid name in comment: expected 'FooBarQuux', not 'fooBarQuux'.
  • invalid name in comment: expected 'FooBarQuux', got 'fooBarQuux'.
  • comment should start with 'FooBarQuux', not 'fooBarQuux'
  • comment should start with 'FooBarQuux', got 'fooBarQuux'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants