Skip to content

detects whether declarations of exported variables, constants, functions, etc. have comments. #4828

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

Closed
2 of 3 tasks
cold-bin opened this issue Jun 19, 2024 · 6 comments
Closed
2 of 3 tasks
Labels

Comments

@cold-bin
Copy link

cold-bin commented Jun 19, 2024

Welcome

Your feature request related to a problem? Please describe

When a new person takes over a large project, it will be painful if there are no comments. This is how I feel that necessary comments need to be provided for public types, variables, functions or methods to facilitate the new person to quickly familiarize themselves with the project.

Describe the solution you'd like

use go/analyze package to recursive traversal ast comment or documention node. if empty the comment and documention node, then call reportf. the link of https://github.com/cold-bin/declaration-comment is my implement

Describe alternatives you've considered

nothing, this way can solve no comments of many complex type

Additional context

No response

Supporter

@cold-bin cold-bin added the enhancement New feature or improvement label Jun 19, 2024
Copy link

boring-cyborg bot commented Jun 19, 2024

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@cold-bin cold-bin changed the title I want add a static code analysis tool that detects whether declarations of exported variables, constants, functions, etc. have comments. I want add a static code analysis tool for golangci-lint that detects whether declarations of exported variables, constants, functions, etc. have comments. Jun 19, 2024
@ldez ldez added no decision No decision to fix or not and removed enhancement New feature or improvement labels Jun 19, 2024
@ldez ldez changed the title I want add a static code analysis tool for golangci-lint that detects whether declarations of exported variables, constants, functions, etc. have comments. detects whether declarations of exported variables, constants, functions, etc. have comments. Jun 19, 2024
@ldez ldez added linter: idea idea of a linter declined and removed no decision No decision to fix or not linter: idea idea of a linter labels Jun 19, 2024
@ldez
Copy link
Member

ldez commented Jun 19, 2024

Hello,

this already exists inside golangci-lint: revive, stylecheck, etc.

@ldez ldez closed this as completed Jun 19, 2024
@ccoVeille
Copy link
Contributor

The only existing linter I know that looks like what is requested would be revive:comment-density

https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comments-density

@cold-bin
Copy link
Author

thank for your reply

@ldez
Copy link
Member

ldez commented Jun 19, 2024

The only existing linter I know that looks like what is requested would be revive:comment-density

This issue is about comments, so there several rules inside revive and stylecheck.

But remember that by default, golangci-lint skips those reports.

https://golangci-lint.run/usage/false-positives/#default-exclusions

To disable those exclusions:

issues:
  exclude-use-default: false

@ccoVeille
Copy link
Contributor

Thanks for providing this information. I totally missed that parameter even I'm using golangci-lint for a while.

I'll have a look, thanks

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

No branches or pull requests

3 participants