-
Notifications
You must be signed in to change notification settings - Fork 374
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
Configure linter for unused methods #292
Comments
Hmm.. I just tried configuring the diff --git a/.golangci.yml b/.golangci.yml
index ff0bbe9..3a53d8c 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -5,6 +5,9 @@ linters-settings:
# it's a comma-separated list of prefixes
local-prefixes: sigs.k8s.io/krew
+ unused:
+ check-exported: false
+
# options for analysis running
run:
# which dirs to skip: they won't be analyzed; That setting reports a lot of false positives, which makes it impossible to use in the CI. Btw, the |
haha that's a bummer. :D They should totally have a flag to ignore usage in tests. |
For a quick win, how about enabling |
Please try out. I'm not sure if/how much it helps. |
Not very useful at the moment but there might be beneficial cases. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/close |
@ahmetb: Closing this issue. In response to this:
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. |
#291 would be useful because packages under internal can only be used in the same repo. Otherwise, they are exported, linter won't complain to prevent false positive. |
Every now and then, we do major refactoring that leaves unused methods behind.
It would be great to have a linter that can notify us about unused methods,
variables, constants. I suspect this is probably easier to configure with "unexported" methods,
variables etc. However, if there's a way to do this with "exported" methods,
variables etc, we should do it because now anything in this repository (sigs.k8s.io/krew/...)
is expected to be used in this repository. So if something is not referenced,
ideally it should be cleaned up.
/label good-first-issue
/priority P3
/kind cleanup
The text was updated successfully, but these errors were encountered: