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

Package comment is not confidence #693

Closed
okhowang opened this issue Jun 1, 2022 · 3 comments · Fixed by #694
Closed

Package comment is not confidence #693

okhowang opened this issue Jun 1, 2022 · 3 comments · Fixed by #694

Comments

@okhowang
Copy link
Contributor

okhowang commented Jun 1, 2022

Is your feature request related to a problem? Please describe.
Currently, a file without doc is reported by rule package-comments with confidence 0.2 .
but it is not check is there other files in package have doc.
I want make this rule more confident

Describe the solution you'd like
check package comment in package level

Describe alternatives you've considered

Additional context
I have build a branch for this issue

@chavacava
Copy link
Collaborator

Hi @okhowang thanks for taking the time of creating the issue and developing a fix. Could you please create the pull request to integrate your code?

@kujenga
Copy link

kujenga commented Oct 24, 2022

Hi @okhowang @chavacava , the changes in #694 have changed the behavior of revive by default when running against single files. e.g. when you clone this repository and run the following command, it produces this error:

$ revive ./rule/package-comments.go 
./rule/package-comments.go:1:1: should have a package comment

Looking in #694 at the bottom there are a few others mentioning this issue as well, who have handled it by disabling this specific linter.

I can understand that it's difficult to solve for this case since it's impossible to know if there are other files in the directory without actually looking at them, but it does seem odd to have single-file usage of revive produce errors by default without extra configuration.

@okhowang
Copy link
Contributor Author

There is no way to let the linter know which type of target (package/directory/file) it is checking as far as I know.
We shouldn't check package comments when lint on file level.

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

Successfully merging a pull request may close this issue.

3 participants