Skip to content

CNTRLPLANE-3791: fix: revert api-lint --whole-files to avoid surfacing pre-existing violations - #9071

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix-linter
Jul 23, 2026
Merged

CNTRLPLANE-3791: fix: revert api-lint --whole-files to avoid surfacing pre-existing violations#9071
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix-linter

Conversation

@bryan-cox

@bryan-cox bryan-cox commented Jul 23, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Reverts the api-lint and api-lint-fix Makefile targets to use --new-from-rev without --whole-files. The --whole-files flag (added in #9016) causes the entire file to be linted when any line changes, surfacing pre-existing violations that the PR author did not introduce.

This restores the original behavior where only changed lines are checked. A follow-up Jira ticket will track fixing all pre-existing linter violations so --whole-files (or full-file linting) can be re-enabled.

Which issue(s) this PR fixes:

Addresses feedback from #9063

Special notes for your reviewer:

This is an alternative to #9063 which proposed removing --new-from-rev entirely and fixing all ~570 pre-existing violations. This PR takes the simpler approach of reverting to the original scoping while a Jira ticket tracks the full cleanup.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Chores
    • Improved API linting consistency by reliably determining the comparison point.
    • Updated API lint and auto-fix commands to focus on changes relative to the resolved base revision.
    • Removed fallback behavior that linted entire files when the base revision was unavailable.

…olations

Reverts the api-lint and api-lint-fix targets to use --new-from-rev
without --whole-files. The --whole-files flag causes the entire file
to be linted when any line changes, surfacing pre-existing violations
that the author did not introduce.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@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 Jul 23, 2026
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The Makefile now derives PULL_BASE_SHA using git rev-parse based on the available upstream fetch remote, without allowing an empty value or applying a separate fallback. Both api-lint and api-lint-fix always pass --new-from-rev=${PULL_BASE_SHA} to golangci-lint and no longer fall back to --whole-files.

Suggested reviewers: enxebre, devguyio

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Only Makefile lint targets changed; no Ginkgo test titles or test files were modified, so there are no unstable test names to flag.
Test Structure And Quality ✅ Passed PR only changes Makefile lint flags; no Ginkgo tests were added or modified, so the test-quality check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only Makefile lint targets changed; no deployment, controller, or scheduling code was modified.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only Makefile changed; no new Ginkgo e2e tests were added, so the IPv6/disconnected-network check is not applicable.
No-Weak-Crypto ✅ Passed PASS: Diff only changes Makefile lint flags; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons were introduced.
Container-Privileges ✅ Passed Only Makefile changed; no container/K8s manifests or privilege-related settings were added or modified.
No-Sensitive-Data-In-Logs ✅ Passed The diff only changes Makefile lint target flags and PULL_BASE_SHA resolution; no logging statements or sensitive data exposure were added.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the Makefile change to stop using --whole-files in api-lint targets.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2026
@bryan-cox bryan-cox changed the title fix: revert api-lint --whole-files to avoid surfacing pre-existing violations CNTRLPLANE-3791: fix: revert api-lint --whole-files to avoid surfacing pre-existing violations Jul 23, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown

@bryan-cox: This pull request references CNTRLPLANE-3791 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

What this PR does / why we need it:

Reverts the api-lint and api-lint-fix Makefile targets to use --new-from-rev without --whole-files. The --whole-files flag (added in #9016) causes the entire file to be linted when any line changes, surfacing pre-existing violations that the PR author did not introduce.

This restores the original behavior where only changed lines are checked. A follow-up Jira ticket will track fixing all pre-existing linter violations so --whole-files (or full-file linting) can be re-enabled.

Which issue(s) this PR fixes:

Addresses feedback from #9063

Special notes for your reviewer:

This is an alternative to #9063 which proposed removing --new-from-rev entirely and fixing all ~570 pre-existing violations. This PR takes the simpler approach of reverting to the original scoping while a Jira ticket tracks the full cleanup.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Chores
  • Improved API linting consistency by reliably determining the comparison point.
  • Updated API lint and auto-fix commands to focus on changes relative to the resolved base revision.
  • Removed fallback behavior that linted entire files when the base revision was unavailable.

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.

@bryan-cox

Copy link
Copy Markdown
Member Author

/area ci-tooling

@openshift-ci openshift-ci Bot added area/ci-tooling Indicates the PR includes changes for CI or tooling and removed do-not-merge/needs-area labels Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Makefile`:
- Line 106: Update the PULL_BASE_SHA assignment to validate that the selected
UPSTREAM_REMOTE/main or main revision resolves successfully and is non-empty,
rather than silently accepting an empty value from git rev-parse. Fail
immediately with a clear error before the lint targets using PULL_BASE_SHA are
defined or invoked, while preserving any explicitly provided valid
PULL_BASE_SHA.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: a8ec9afb-8964-4507-892e-11c7dd8806a9

📥 Commits

Reviewing files that changed from the base of the PR and between b5f3906 and ded8a01.

📒 Files selected for processing (1)
  • Makefile

Comment thread Makefile
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.50%. Comparing base (b5f3906) to head (ded8a01).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9071   +/-   ##
=======================================
  Coverage   44.50%   44.50%           
=======================================
  Files         774      774           
  Lines       96980    96980           
=======================================
  Hits        43164    43164           
  Misses      50828    50828           
  Partials     2988     2988           
Flag Coverage Δ
cmd-support 38.39% <ø> (ø)
cpo-hostedcontrolplane 47.19% <ø> (ø)
cpo-other 45.25% <ø> (ø)
hypershift-operator 54.44% <ø> (ø)
other 32.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bryan-cox
bryan-cox marked this pull request as ready for review July 23, 2026 11:44
@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 Jul 23, 2026
@openshift-ci
openshift-ci Bot requested review from csrwng and ironcladlou July 23, 2026 11:45

@devguyio devguyio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@bryan-cox

Copy link
Copy Markdown
Member Author

/verified by linter passing in gha

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This PR has been marked as verified by linter passing in gha.

Details

In response to this:

/verified by linter passing in gha

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 openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-azure-v2-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-gke
/test unit
/test verify

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, devguyio

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@bryan-cox

Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-aks
/override ci/prow/e2e-aws
/override ci/prow/e2e-aws-upgrade-hypershift-operator
/override ci/prow/e2e-azure-v2-self-managed
/override ci/prow/e2e-kubevirt-aws-ovn-reduced
/override ci/prow/e2e-v2-aws
/override ci/prow/e2e-v2-gke

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/e2e-aks, ci/prow/e2e-aws, ci/prow/e2e-aws-upgrade-hypershift-operator, ci/prow/e2e-azure-v2-self-managed, ci/prow/e2e-kubevirt-aws-ovn-reduced, ci/prow/e2e-v2-aws, ci/prow/e2e-v2-gke

Details

In response to this:

/override ci/prow/e2e-aks
/override ci/prow/e2e-aws
/override ci/prow/e2e-aws-upgrade-hypershift-operator
/override ci/prow/e2e-azure-v2-self-managed
/override ci/prow/e2e-kubevirt-aws-ovn-reduced
/override ci/prow/e2e-v2-aws
/override ci/prow/e2e-v2-gke

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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 2b7986f into openshift:main Jul 23, 2026
41 checks passed
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

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.

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. area/ci-tooling Indicates the PR includes changes for CI or tooling 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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants