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

Cleanup: uplevel our technical hygiene by enabling additional Golang linters #5899

Closed
30 of 39 tasks
bendory opened this issue Dec 20, 2022 · 9 comments
Closed
30 of 39 tasks
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@bendory
Copy link
Contributor

bendory commented Dec 20, 2022

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:

@bendory bendory added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 20, 2022
@bendory
Copy link
Contributor Author

bendory commented Dec 20, 2022

I would assign this issue to me, but I don't seem to have the authority to do so. 🙃

@bendory
Copy link
Contributor Author

bendory commented Dec 20, 2022

#5871 Added govet to our Golang linter suite
#5881 Replaced deprecated deadcode linter with unused linter
#5889 Enabled the whitespace linter.

@vdemeester
Copy link
Member

/assign @bendory
(btw, if you comment /assign, it should automatically assign the issue to you 😉 )

@vdemeester
Copy link
Member

(ah lol, @jerop manually assigned you already 😂 )

@bendory
Copy link
Contributor Author

bendory commented Dec 22, 2022

See also: tektoncd/community#908 Add Go style guide to community standards (thanks @lbernick)

tekton-robot pushed a commit that referenced this issue Dec 28, 2022
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
tekton-robot pushed a commit to tektoncd/plumbing that referenced this issue Dec 28, 2022
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
tekton-robot pushed a commit that referenced this issue Dec 29, 2022
Given cleanup in #5923, there
are no required code changes for this linter to lint clean.

Context: #5899

/kind cleanup
tekton-robot pushed a commit that referenced this issue Dec 29, 2022
Enabled `bodyclose`, `decorder`, and `typecheck`.

These currently lint clean, so there are no needed code changes.

Context: #5899

/kind cleanup
tekton-robot pushed a commit that referenced this issue Jan 2, 2023
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
@lbernick lbernick added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Feb 7, 2023
tekton-robot pushed a commit that referenced this issue Feb 28, 2023
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
```
EmmaMunley pushed a commit to EmmaMunley/pipeline that referenced this issue Mar 9, 2023
- 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
```
EmmaMunley pushed a commit to EmmaMunley/pipeline that referenced this issue Mar 9, 2023
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
EmmaMunley pushed a commit to EmmaMunley/pipeline that referenced this issue Mar 9, 2023
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
EmmaMunley pushed a commit to EmmaMunley/pipeline that referenced this issue Mar 9, 2023
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
tekton-robot pushed a commit that referenced this issue Mar 9, 2023
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
@bendory bendory mentioned this issue Mar 9, 2023
3 tasks
EmmaMunley pushed a commit to EmmaMunley/pipeline that referenced this issue Mar 10, 2023
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
tekton-robot pushed a commit that referenced this issue Mar 30, 2023
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
```
tekton-robot pushed a commit that referenced this issue Apr 5, 2023
- 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
tekton-robot pushed a commit that referenced this issue Apr 10, 2023
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
tekton-robot pushed a commit to tektoncd/plumbing that referenced this issue Apr 12, 2023
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
tekton-robot pushed a commit to tektoncd/plumbing that referenced this issue Apr 18, 2023
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
tekton-robot pushed a commit that referenced this issue Apr 19, 2023
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.
@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 2, 2023
@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 1, 2023
@tekton-robot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link
Collaborator

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
Status: Done
Development

No branches or pull requests

4 participants