-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Cleanup: uplevel our technical hygiene by enabling additional Golang linters #5899
Comments
I would assign this issue to me, but I don't seem to have the authority to do so. 🙃 |
/assign @bendory |
(ah lol, @jerop manually assigned you already 😂 ) |
See also: tektoncd/community#908 Add Go style guide to community standards (thanks @lbernick) |
There are no expected functional changes in this PR. The code changes are duplicate words discovered by the `dupword` linter, for example, `the the` --> `the`. Occasional deduped words appear in unit test strings where I've uniqified the words in question. The `dupword` linter will be enabled in #5918. Context: #5899 /kind cleanup
This change will update our plumbing to include #1308 as well as any other changes since the last upgrade. Context: tektoncd/pipeline#5918 (comment) Issue: tektoncd/pipeline#5899
Enabled `bodyclose`, `decorder`, and `typecheck`. These currently lint clean, so there are no needed code changes. Context: #5899 /kind cleanup
This linter cleans up our test output by omiting helper functions from test failure messages, instead labeling the failure with the calling function's details. This makes it easier to locate the true origin of the failure. There are no expected functional changes in this PR. The code changes in this PR are all changes to testing code to comply with Go style and best practices, specifically `t.Helper`: - https://pkg.go.dev/testing#T.Helper - https://goo.gle/go-style/best-practices#error-handling-in-test-helpers Context: #5899 /kind cleanup
This PR enables golangci presets format, import, metalinter, module, unused, test. Code changes correspond to the issues found by linters. There are no expected functional changes in this PR. Context: #5899 /kind cleanup - Submitter Checklist As the author of this PR, please check off the items in this checklist: - [N/A] Has [Docs](https://github.com/tektoncd/community/blob/main/standards.md#docs) included if any changes are user facing - [N/A] Has [Tests](https://github.com/tektoncd/community/blob/main/standards.md#tests) included if any functionality added or changed - [x] Follows the [commit message standard](https://github.com/tektoncd/community/blob/main/standards.md#commits) - [x] Meets the [Tekton contributor standards](https://github.com/tektoncd/community/blob/main/standards.md) (including functionality, content, code) - [x] Has a kind label. You can add one by adding a comment on this PR that contains `/kind <type>`. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [N/A] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings) - [N/A] Release notes contains the string "action required" if the change requires additional action from users switching to the new release - Release Notes ```release-note NONE ```
- Sort linters list. - Replaces deprecated `exclude` configuration for `errcheck` with replacement `exclude-functions` configuration. - Deletes obsolete `depguard` configuration. - Deletes obsolete skip `unused` configuration for `pipelinerun_test.go`. Context: tektoncd#5899 /kind cleanup <!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 --> - [N/A] Has [Docs](https://github.com/tektoncd/community/blob/main/standards.md#docs) included if any changes are user facing - [N/A] Has [Tests](https://github.com/tektoncd/community/blob/main/standards.md#tests) included if any functionality added or changed - [x] Follows the [commit message standard](https://github.com/tektoncd/community/blob/main/standards.md#commits) - [x] Meets the [Tekton contributor standards](https://github.com/tektoncd/community/blob/main/standards.md) (including functionality, content, code) - [x] Has a kind label. You can add one by adding a comment on this PR that contains `/kind <type>`. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [x] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings) - [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release ```release-note NONE ```
There are no expected functional changes in this PR. Made nominal code changes to adhere to linter standards, specifically more systematic use of `pipeline.*RunControllerName` constants. Context: tektoncd#5899 /kind cleanup - [N/A] Has [Docs](https://github.com/tektoncd/community/blob/main/standards.md#docs) included if any changes are user facing - [N/A] Has [Tests](https://github.com/tektoncd/community/blob/main/standards.md#tests) included if any functionality added or changed - [x] Follows the [commit message standard](https://github.com/tektoncd/community/blob/main/standards.md#commits) - [x] Meets the [Tekton contributor standards](https://github.com/tektoncd/community/blob/main/standards.md) (including functionality, content, code) - [x] Has a kind label. You can add one by adding a comment on this PR that contains `/kind <type>`. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [x] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings) - [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release
This linter identifies unused variable assignments. - Fixes identified lint issues. - Updated configuration to ignore inefective assignments in unit tests. Context: tektoncd#5899 /kind cleanup <!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 --> - [N/A] Has [Docs](https://github.com/tektoncd/community/blob/main/standards.md#docs) included if any changes are user facing - [N/A] Has [Tests](https://github.com/tektoncd/community/blob/main/standards.md#tests) included if any functionality added or changed - [x] Follows the [commit message standard](https://github.com/tektoncd/community/blob/main/standards.md#commits) - [x] Meets the [Tekton contributor standards](https://github.com/tektoncd/community/blob/main/standards.md) (including functionality, content, code) - [x] Has a kind label. You can add one by adding a comment on this PR that contains `/kind <type>`. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [x] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings) - [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release
Enables `containedctx` linter to identify use of antipattern use of context as a struct field. Go style is to pass the context directly instead. To get here, I added exclusions for the existing detected use; enabling the linter will prevent additional use of the antipattern. There are no expected functional changes in this PR. Context: tektoncd#5899 /kind cleanup <!-- 🎉🎉🎉 Thank you for the PR!!! 🎉🎉🎉 --> - Submitter Checklist - [N/A] Has [Docs](https://github.com/tektoncd/community/blob/main/standards.md#docs) included if any changes are user facing - [N/A] Has [Tests](https://github.com/tektoncd/community/blob/main/standards.md#tests) included if any functionality added or changed - [x] Follows the [commit message standard](https://github.com/tektoncd/community/blob/main/standards.md#commits) - [x] Meets the [Tekton contributor standards](https://github.com/tektoncd/community/blob/main/standards.md) (including functionality, content, code) - [x] Has a kind label. You can add one by adding a comment on this PR that contains `/kind <type>`. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [x] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings) - [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release
There are no expected functional changes in this PR. Made non-functional code changes to adhere to linter standards. Context: #5899 See related style docs: - https://github.com/golang/go/wiki/Errors#naming - https://google.github.io/styleguide/go/guide#concision - https://go.dev/blog/errors-are-values
There are no expected functional changes in this PR. Made non-functional code changes to adhere to linter standards. Context: tektoncd#5899 See related style docs: - https://github.com/golang/go/wiki/Errors#naming - https://google.github.io/styleguide/go/guide#concision - https://go.dev/blog/errors-are-values
There are no expected functional changes in this PR. Made non-functional code changes to adhere to Golang error standards. Context: #5899 See related style docs: - https://pkg.go.dev/errors - https://go.dev/blog/errors-are-values /kind cleanup - [N/A] Has [Docs](https://github.com/tektoncd/community/blob/main/standards.md#docs) included if any changes are user facing - [N/A] Has [Tests](https://github.com/tektoncd/community/blob/main/standards.md#tests) included if any functionality added or changed - [x] Follows the [commit message standard](https://github.com/tektoncd/community/blob/main/standards.md#commits) - [x] Meets the [Tekton contributor standards](https://github.com/tektoncd/community/blob/main/standards.md) (including functionality, content, code) - [x] Has a kind label. You can add one by adding a comment on this PR that contains `/kind <type>`. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [N/A] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings) - [N/A] Release notes contains the string "action required" if the change requires additional action from users switching to the new release ```release-note NONE ```
- Addressed newly identified `errorlint` items. - Narrowed `nolint` --> `nolint:gocritic`. - Removed 2 `nolint` comments by addressing identified issues. - Also: cleaned up some test logic in pipelinerun_test.go. There are no expected functional changes in this PR. Context: #5899 /kind cleanup
The [exhaustive](https://pkg.go.dev/github.com/nishanths/exhaustive) linter checks exhaustiveness of switch statements, ensuring completeness of case statements. There are no expected functional changes in this CL. Context: #5899
This enables some new linters and disables some deprecated ones. Context: tektoncd/pipeline#5899 This PR is step one in unblocking tektoncd/pipeline#6518 /kind cleanup
This change will update our plumbing to include #1389 as well as any other changes since the last upgrade. Context: tektoncd/pipeline#6518 Issue: tektoncd/pipeline#5899 /kind cleanup
See this thread: https://tektoncd.slack.com/archives/CJ4ERJWAU/p1681920119203019 Context: #5899 Disabled `revive` linter; upgrade results in a high number of new unused variables not previously identified in the previous version.
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
@tekton-robot: 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. |
Feature request
golangci-lint
which we have configured supports additional helpful linters that we are not using.This FR suggests that we uplevel our technical hygiene by enabling more linters and cleaning up
the issues they identify.
Note: I'd like to see the same linter suite applied across all
tektoncd
repos.Documentation: https://golangci-lint.run/usage/linters
See also: http://goo.gle/go-style
Linters that I would like to see enabled:
containedctx
linter. #6261goconst
,dogsled
linters. #6262dupword
andusestdlibvars
linters. #5918errorlint
. #6340exhaustive
linter. #6484goconst
,dogsled
linters. #6262gosimple
linter. #5904ineffassign
linter. 🧹🧹🧹 #6259nosnakecase(deprecated)thelper
linter. #5927deadcode
linter withunused
linter. #5881dupword
andusestdlibvars
linters. #5918whitespace
linter. #5889The text was updated successfully, but these errors were encountered: