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

Switch the linter from golint to revive, and fix warnings. #4212

Merged
merged 1 commit into from
Sep 6, 2021

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Sep 2, 2021

Changes

This finishes up the switch from the deprecated golint to
revive, which is the replacement. This was started in #4206.

This consisted of one new lint warning, and switching some
suppressions to revive from golint.

Signed-off-by: Dan Lorenc [email protected]

/kind cleanup

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

Release Notes

NONE

@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. labels Sep 2, 2021
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 2, 2021
@dlorenc
Copy link
Contributor Author

dlorenc commented Sep 2, 2021

Looks like we might have to wait for tektoncd/plumbing#882 since 1.39 throws some warnings that 1.42 doesn't.

@dlorenc
Copy link
Contributor Author

dlorenc commented Sep 2, 2021

/test pull-tekton-pipeline-build-tests

@vdemeester
Copy link
Member

pkg/pullrequest/disk.go:99:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := refToDisk("base", path, r.PR.Base); err != nil {
		return err
	}
pkg/apis/pipeline/v1beta1/resource_types_validation.go:70:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := validateTaskRunResources(ctx, tr.Outputs, "spec.resources.outputs.name"); err != nil {
		return err
	}
pkg/apis/pipeline/v1alpha1/condition_validation.go:55:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := validateSteps([]Step{cs.Check}).ViaField("Check"); err != nil {
		return err
	}
pkg/apis/pipeline/v1alpha1/run_validation.go:73:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := validateWorkspaceBindings(ctx, rs.Workspaces); err != nil {
		return err
	}
pkg/apis/pipeline/v1alpha1/task_validation.go:143:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := validateResourceVariables(ts.Steps, ts.Inputs, ts.Outputs, ts.Resources); err != nil {
		return err
	}
pkg/apis/pipeline/v1alpha1/pipeline_validation.go:178:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := validatePipelineWorkspaces(ps.Workspaces, ps.Tasks); err != nil {
		return err
	}
pkg/termination/write.go:64:2: if-return: redundant if ...; err != nil check, just return error instead. (revive)
	if err := f.Sync(); err != nil {
		return err
	}

Failure is legit I think. Does revive do something similar to go vet, where depending on the number of errors and "gravity" they do not show everything (so after you fix something it will show new warning) ?

@dlorenc
Copy link
Contributor Author

dlorenc commented Sep 3, 2021

If I run golangci-lint 1.42 locally, I see no errors. If I run it with 1.39, I see these. My guess was that the plumbing change hadn't taken effect yet. Might be worth just fixing these though...

@dlorenc
Copy link
Contributor Author

dlorenc commented Sep 3, 2021

/test pull-tekton-pipeline-build-tests

This finishes up the switch from the deprecated golint to
revive, which is the replacement. This was started in tektoncd#4206.

This consisted of one new lint warning, switching some
suppressions to revive from golint, and fixing some new errors.

Signed-off-by: Dan Lorenc <[email protected]>
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/condition_validation.go 83.3% 80.0% -3.3
pkg/apis/pipeline/v1alpha1/pipeline_validation.go 97.1% 97.0% -0.0
pkg/apis/pipeline/v1alpha1/run_validation.go 92.3% 91.7% -0.6
pkg/apis/pipeline/v1alpha1/task_validation.go 82.8% 82.6% -0.2
pkg/pullrequest/disk.go 79.5% 79.9% 0.4
pkg/termination/write.go 68.2% 70.0% 1.8

@dlorenc
Copy link
Contributor Author

dlorenc commented Sep 3, 2021

OK, I gave up and fixed them.

Copy link
Member

@mattmoor mattmoor 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 Sep 6, 2021
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, vdemeester

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2021
@vdemeester
Copy link
Member

/retest

@tekton-robot tekton-robot merged commit c975119 into tektoncd:main Sep 6, 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. 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-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants