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

🌱 Enable godoc linter checks #4631

Merged
merged 2 commits into from
May 20, 2021

Conversation

stmcginnis
Copy link
Contributor

What this PR does / why we need it:

This is a continuation of the work being done to enable some of the excluded linters we use.

This change removes the exclusions related to enforcing godoc comments for packages and
functions, variables, and other things that are public. It makes they all have associated doc
strings and that any package comments are in the expected format of Package x....

For package docs, if a given package was less than five separate files the comments were just
added to the package statement in the first file. If there were five or more, a doc.go file was
added to keep it separate and easy to find.

Which issue(s) this PR fixes:
Related #4622

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 18, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @stmcginnis. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 18, 2021
@@ -48,8 +48,6 @@ issues:
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# The following are being worked on to remove their exclusion. This list should be reduced or go away all together over time.
# If it is decided they will not be addressed they should be moved above this comment.
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
- package comment should be of the form "Package (.+) ..."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this exclusion? Seems a lot of comment are in the form of package X implements X, which isn't really super useful?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have strong opinions here.
Ideally we should get few lines explaining what each package is, but the linter just ensures a minimal comment exist, not that an actual explanation exists.
However, if we consider this as a starting point I'm ok with enabling this linter/this PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My worry is that we add these descriptions to satisfy the linter, and provide no information to our users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep the regex for just packages, but I would actually like to keep this.

I agree most of the docstrings are not very helpful right now. But at least they have a basis to be improved upon. There are a couple cases where it actually did add some helpful information and caught where there were good godocs, but not formatted correctly to show up in IDE help because of where they were placed. And it would help make sure any new packages added at least force the authors to think about whether there is anything helpful to add to the godocs.

So bottom line, the added value is questionable, but it at least has potential for helping without much of a downside. Does that make sense to you @vincepri?

@vincepri
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 18, 2021
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2021
@vincepri
Copy link
Member

Need a rebase

This removes another of our linter exclusions to enforce linting that
will error if packages or exported types do not have godoc comments on
them.

Signed-off-by: Sean McGinnis <[email protected]>
This removes the linting exclusion to make sure package godoc strings
are in the expected format of "Package x...".

Signed-off-by: Sean McGinnis <[email protected]>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2021
@stmcginnis
Copy link
Contributor Author

/test pull-cluster-api-test-main

Unrelated failures.

@stmcginnis
Copy link
Contributor Author

Merge conflicts resolved and tests are happy again. Please take a look again when you have some time @vincepri - thanks!

@vincepri
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 20, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5858391 into kubernetes-sigs:master May 20, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.4 milestone May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants