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

OCPBUGS-45421: Linter fixes #1253

Merged
merged 3 commits into from
Dec 16, 2024

Conversation

jmencak
Copy link
Contributor

@jmencak jmencak commented Dec 12, 2024

Golangci-linter configuration ".ci-operator.yaml" was configured in a way which was showing a lot of false positives and also missing a lot of issues.

Fix both the linter configuration and the missing issues that found its way into the codebase.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 12, 2024
@openshift-ci openshift-ci bot requested review from dagrayvid and yanirq December 12, 2024 17:30
Copy link
Contributor

openshift-ci bot commented Dec 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jmencak

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2024
@jmencak
Copy link
Contributor Author

jmencak commented Dec 12, 2024

Golangci-linter configuration ".ci-operator.yaml" was configured in a way
which was showing a lot of false positives and also missing a lot of issues.

Fix both the linter configuration and the missing issues that found its way
into the codebase.
@jmencak jmencak force-pushed the 4.19-golang-1.23-linter branch from 75a8a5b to 2fc45c3 Compare December 12, 2024 20:24
@jmencak
Copy link
Contributor Author

jmencak commented Dec 13, 2024

ci/prow/e2e-gcp-pao-updating-profile failed due to infra issues
/retest

@jmencak
Copy link
Contributor Author

jmencak commented Dec 13, 2024

The ci/prow/e2e-gcp-pao-updating-profile has a problem I can reproduce locally. Looking into fixing this.

@jmencak
Copy link
Contributor Author

jmencak commented Dec 13, 2024

ci/prow/e2e-aws-ovn and ci/prow/okd-scos-e2e-aws-ovn failures are not relevant to this PR,

Tests in 7_performance_kubelet_node/kubelet.go are broken and need
fixing, keep the current semantics and make the linter pass.
@jmencak jmencak changed the title WiP: Linter fixes OCPBUGS-45421: Linter fixes Dec 15, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 15, 2024
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 15, 2024
@openshift-ci-robot
Copy link
Contributor

@jmencak: This pull request references Jira Issue OCPBUGS-45421, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.19.0) matches configured target version for branch (4.19.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira ([email protected]), skipping review request.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Golangci-linter configuration ".ci-operator.yaml" was configured in a way which was showing a lot of false positives and also missing a lot of issues.

Fix both the linter configuration and the missing issues that found its way into the codebase.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Dec 15, 2024
@jmencak
Copy link
Contributor Author

jmencak commented Dec 15, 2024

/cc @mrniranjan
I believe that 7_performance_kubelet_node/kubelet.go is (and was) fundamentally broken. It would be great if someone with the knowledge of the tests purpose could fix it.

@openshift-ci openshift-ci bot requested a review from mrniranjan December 15, 2024 12:22
Copy link
Contributor

openshift-ci bot commented Dec 15, 2024

@jmencak: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-e2e-aws-ovn 0469f59 link false /test okd-scos-e2e-aws-ovn

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@jmencak
Copy link
Contributor Author

jmencak commented Dec 15, 2024

This PR is ready for review, ci/prow/okd-scos-e2e-aws-ovn failures is a known issue.

@jmencak
Copy link
Contributor Author

jmencak commented Dec 15, 2024

/cc @rbaturov

@openshift-ci openshift-ci bot requested a review from rbaturov December 15, 2024 15:39
Copy link
Contributor

@ffromani ffromani left a comment

Choose a reason for hiding this comment

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

/lgtm

looks OK to me

Comment on lines 45 to 52
testutils.CustomBeforeAll(func() {
var err error

workerRTNodes, err = nodes.GetByLabels(testutils.NodeSelectorLabels)
// TODO: The code here is broken as it masks workerRTNodes defined above
// and the value of workerRTNodes is never used. Keep the linter happy for now
// and remove the ineffectual assignment of workerRTNodes, err = nodes.MatchingOptionalSelector(workerRTNodes) below.
workerRTNodes, err := nodes.GetByLabels(testutils.NodeSelectorLabels)
Expect(err).ToNot(HaveOccurred())

workerRTNodes, err = nodes.MatchingOptionalSelector(workerRTNodes)
_, err = nodes.MatchingOptionalSelector(workerRTNodes)
Copy link
Contributor

Choose a reason for hiding this comment

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

this means we need a deep review of this suite. Let's put an AI on ourselves

@ffromani
Copy link
Contributor

/hold

to let others review

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 16, 2024
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2024
ginkgo.By("cluster changes rollback")
if node != nil {
util.ExecAndLogCommand("oc", "label", "node", "--overwrite", node.Name, nodeLabelRealtime+"-")
_, _, _ = util.ExecAndLogCommand("oc", "label", "node", "--overwrite", node.Name, nodeLabelRealtime+"-")
Copy link
Contributor

Choose a reason for hiding this comment

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

the linter cannot ignore these at all ? I hope this will not complicated automated cherry picks too much

Copy link
Contributor Author

@jmencak jmencak Dec 16, 2024

Choose a reason for hiding this comment

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

You can exclude these checks by something like:

    - linters:
        - errcheck
      text: "Error return value of .* is not checked"

however, I'm not sure I'm in favour of doing that as it will mask a lot of cases where the checking is warranted. This PR includes so many fixes and changes that the backports will be difficult anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally, in the future, I believe it is worth adding even more linters. Look at the benefit so far -- we might catch more things.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok . lets align with the linter

configv1.AddToScheme(scheme.Scheme)
mcov1.AddToScheme(scheme.Scheme)
tunedv1.AddToScheme(scheme.Scheme)
utilruntime.Must(performancev2.AddToScheme(scheme.Scheme))
Copy link
Contributor

Choose a reason for hiding this comment

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

what was the case here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pkg/performanceprofile/controller/performanceprofile_controller_suite_test.go:21:27: Error return value is not checked (errcheck)
        performancev2.AddToScheme(scheme.Scheme)

@yanirq
Copy link
Contributor

yanirq commented Dec 16, 2024

/lgtm

@ffromani
Copy link
Contributor

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 16, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit d24467f into openshift:master Dec 16, 2024
16 of 17 checks passed
@openshift-ci-robot
Copy link
Contributor

@jmencak: Jira Issue OCPBUGS-45421: Some pull requests linked via external trackers have merged:

The following pull requests linked via external trackers have not merged:

These pull request must merge or be unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with /jira refresh.

Jira Issue OCPBUGS-45421 has not been moved to the MODIFIED state.

In response to this:

Golangci-linter configuration ".ci-operator.yaml" was configured in a way which was showing a lot of false positives and also missing a lot of issues.

Fix both the linter configuration and the missing issues that found its way into the codebase.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cluster-node-tuning-operator
This PR has been included in build cluster-node-tuning-operator-container-v4.19.0-202412161449.p0.gd24467f.assembly.stream.el9.
All builds following this will include this PR.

@jmencak jmencak deleted the 4.19-golang-1.23-linter branch December 18, 2024 21:12
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. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants