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

Hygiene: enable linters for error conventions. #6264

Merged
merged 1 commit into from
Mar 9, 2023
Merged

Hygiene: enable linters for error conventions. #6264

merged 1 commit into from
Mar 9, 2023

Conversation

bendory
Copy link
Contributor

@bendory bendory commented Mar 1, 2023

Changes

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:

/kind cleanup

Submitter Checklist

  • [N/A] Has Docs included if any changes are user facing
  • [N/A] Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • 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
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes


action required: 

- `resolution.ErrorRequestedResourceIsNil` is deprecated; change references to `resolution.ErrNilResource`.
- `remote.ErrorRequestInProgress` is deprecated; change references to `remote.ErrRequestInProgress`.
- in package `cmd/entrypoint/subcommands`, `SubcommandSuccessful` type is deprecated, use type `OK`.
- in package `resolution/common`, `ErrorRequestInProgress` is deprecated; change references to `ErrRequestInProgress`.
- in package `resolution/common`, all errors of type `Error*` have been renamed to type `*Error`.
- in package `resolution/framework`, `ErrorMissingTypeSelector` is deprecated; change references to `ErrMissingTypeSelector`

Trusted Resources are in alpha; the following breaking changes are included in this PR:

- in package `trustedresources`:
  - `ErrorResourceVerificationFailed` is replaced by `ErrResourceVerificationFailed`
  - `ErrorEmptyVerificationConfig` is replaced by `ErrEmptyVerificationConfig`
  - `ErrorNoMatchedPolicies` is replaced by `ErrNoMatchedPolicies`
  - `ErrorRegexMatch` is replaced by `ErrRegexMatch`
  - `ErrorSignatureMissing` is replaced by `ErrSignatureMissing`
- in package `trustedresources/verifier`:
  - `ErrorFailedLoadKeyFile` is replaced by `ErrFailedLoadKeyFile`
  - `ErrorDecodeKey` is replaced by `ErrDecodeKey`
  - `ErrorEmptyPublicKeys` is replaced by `ErrEmptyPublicKeys`
  - `ErrorEmptySecretData` is replaced by `ErrEmptySecretData`
  - `ErrorSecretNotFound` is replaced by `ErrSecretNotFound`
  - `ErrorMultipleSecretData` is replaced by `ErrMultipleSecretData`
  - `ErrorEmptyKey` is replaced by `ErrEmptyKey`
  - `ErrorK8sSpecificationInvalid` is replaced by `ErrK8sSpecificationInvalid`
  - `ErrorLoadVerifier` is replaced by `ErrLoadVerifier`
  - `ErrorAlgorithmInvalid` is replaced by `ErrAlgorithmInvalid`

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 1, 2023
@bendory
Copy link
Contributor Author

bendory commented Mar 1, 2023

/retest-required

@bendory
Copy link
Contributor Author

bendory commented Mar 1, 2023

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@bendory: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-alpha-integration-tests
  • /test pull-tekton-pipeline-beta-integration-tests
  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-integration-tests
  • /test tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

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.

Copy link
Member

@Yongxuanzhang Yongxuanzhang left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks! There are lot of error naming changes in trusted resources. 😄

pkg/remote/resolution/error.go Outdated Show resolved Hide resolved
cmd/entrypoint/subcommands/subcommands.go Show resolved Hide resolved
@tekton-robot tekton-robot added lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 2, 2023
@bendory
Copy link
Contributor Author

bendory commented Mar 3, 2023

/test pull-tekton-pipeline-alpha-integration-tests

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

qq: for these linter PRs, do you have any sense of how well these plugins are being maintained, and whether the plugins represent generally accepted code style or just the opinions of the plugin author? I'm curious because I don't see anything wrong with SubcommandSuccessful as a function name, but this linter seems to have a problem with it.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 3, 2023
@bendory
Copy link
Contributor Author

bendory commented Mar 3, 2023

qq: for these linter PRs, do you have any sense of how well these plugins are being maintained, and whether the plugins represent generally accepted code style or just the opinions of the plugin author? I'm curious because I don't see anything wrong with SubcommandSuccessful as a function name, but this linter seems to have a problem with it.

It is maintained well enough that it's included by Go as a standard module; it's been adopted by Google, RedHat OpenShift, AWS, IBM, FaceBook, Netflix, and other major companies.

With regard to SubcommandSuccessful, that's against the error naming convention

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

Overall LGTM, one "nit" about not only renaming the error but maybe aliasing and mark as deprecated the old ones 👼🏼

pkg/remote/errors.go Outdated Show resolved Hide resolved
pkg/remote/resolution/error.go Outdated Show resolved Hide resolved
pkg/remote/errors.go Outdated Show resolved Hide resolved
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Mar 6, 2023
@bendory
Copy link
Contributor Author

bendory commented Mar 6, 2023

/retest-required

2 similar comments
@bendory
Copy link
Contributor Author

bendory commented Mar 7, 2023

/retest-required

@bendory
Copy link
Contributor Author

bendory commented Mar 7, 2023

/retest-required

@tekton-robot tekton-robot added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 7, 2023
pkg/remote/resolution/error.go Show resolved Hide resolved
pkg/resolution/common/errors.go Show resolved Hide resolved
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 8, 2023
@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 8, 2023
@bendory bendory requested a review from wlynch March 9, 2023 01:02
@bendory
Copy link
Contributor Author

bendory commented Mar 9, 2023

Test failure is happening at main as well, so I don't think it's me...

@bendory
Copy link
Contributor Author

bendory commented Mar 9, 2023

/retest-required

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
Copy link
Member

@wlynch wlynch left a comment

Choose a reason for hiding this comment

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

/lgtm

🎉 🎉 🎉

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2023
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lbernick, wlynch, Yongxuanzhang

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

@tekton-robot tekton-robot merged commit 16d41ca into tektoncd:main Mar 9, 2023
@bendory bendory deleted the err branch March 9, 2023 21:01
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants