Skip to content

chore: ignore flake8 rules now handled by ruff#4703

Merged
rnetser merged 1 commit intoRedHatQE:mainfrom
rnetser:chore/flake8-ignore-ruff-handled-rules
May 4, 2026
Merged

chore: ignore flake8 rules now handled by ruff#4703
rnetser merged 1 commit intoRedHatQE:mainfrom
rnetser:chore/flake8-ignore-ruff-handled-rules

Conversation

@rnetser
Copy link
Copy Markdown
Collaborator

@rnetser rnetser commented May 3, 2026

What this PR does / why we need it:

Ruff v0.15.x handles several rules with better context awareness than flake8 (dataclass fields, method overrides, formatter-managed line length). When ruff removes inline # noqa comments it considers unnecessary, flake8 still enforces those rules, causing CI conflicts.

This PR ignores those rules in .flake8 to prevent conflicts between the two linters:

  • N815: camelCase in class scope — ruff understands dataclass fields matching API schemas
  • N802: function name should be lowercase — ruff understands method overrides (e.g. formatTime)
  • E501: line too long — ruff formatter manages line length
  • F821: undefined name — used in global_config files with dynamic exec() loading
  • E201: whitespace after ( — ruff formatter manages whitespace
  • W503: line break before binary operator — PEP 8 reversed this; ruff uses W504 (after)
  • N818: exception name should end with Error — ruff allows existing names like MissingTemplateVariables

Also adds with_suffix and writelines to fcn_exclude_functions to prevent FCN001 false positives on standard library calls.

Part 1 of a 6-PR series to clean up lint configuration and apply safe fixes:

  1. This PR.flake8 ignore rules
  2. pyproject.toml ruff ignore rules for preview rules
  3. Remove stale # noqa comments (depends on PRs 1+2)
  4. Remove obsolete utf-8 coding headers
  5. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
  6. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude noreply@anthropic.com

Which issue(s) this PR fixes:

Replaces #4701 with a smaller, incremental approach.

Special notes for reviewer:

No code changes — config only. All pre-commit hooks pass on all files.

jira-ticket:

Summary by CodeRabbit

  • Chores
    • Updated linting configuration: removed hard line-length enforcement in favor of centralized formatting, suppressed a targeted set of stylistic and specific error checks, and added inline notes clarifying that certain rules (including line-length and whitespace checks) are managed by the code formatter.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 45175428-c72b-41e4-ae10-701696642288

📥 Commits

Reviewing files that changed from the base of the PR and between 81c5264 and 3528b84.

📒 Files selected for processing (1)
  • .flake8

📝 Walkthrough

Walkthrough

The .flake8 configuration was changed: the max-line-length = 120 entry was removed and an ignore list was added to suppress specific Flake8 codes (N815, N802, E501, F821, E201, W503, N818) with inline comments noting overlap/management by ruff.

Changes

Flake8 ignore list update

Layer / File(s) Summary
Configuration Update
.flake8
Removed max-line-length = 120 and added ignore = N815, N802, E501, F821, E201, W503, N818 with comments explaining which checks are handled by ruff or intentionally suppressed (line-length, whitespace, certain naming/exception rules, and F821 for dynamic globals).
Inline rationale/comments
.flake8
Added explanatory comments mapping ignored codes to ruff responsibilities and to specific intentional suppressions (e.g., dynamic global loading causing F821).

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: ignoring flake8 rules now handled by ruff, which is the core purpose of the PR.
Description check ✅ Passed The description is comprehensive and covers all required template sections with specific details about rules ignored, rationale for each, context within a multi-PR series, and acknowledgment of dependencies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest verify-bugs-are-open - verify-bugs-are-open
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • dshchedr
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • RoniKishner
  • dshchedr
  • rnetser
  • vsibirsk
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

@rnetser
Copy link
Copy Markdown
Collaborator Author

rnetser commented May 3, 2026

/verified
/approve

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In @.flake8:
- Around line 5-14: The comment in .flake8 incorrectly claims N815, N802, and
N818 are "now handled by ruff" but ruff won't run pep8-naming rules unless you
enable them; fix by either 1) rewriting the comment in .flake8 to explicitly
state these N rules are intentionally suppressed (give concise rationale for
N815, N802, N818) or 2) enable pep8-naming in ruff by adding a [tool.ruff.lint]
section to pyproject.toml with extend-select = ["N"] and then update the .flake8
ignore list and comments to reflect that naming rules are delegated to ruff
(ensure N815, N802, N818 handling is clear).
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5827cb49-85c6-46a1-ba27-189f1dd81c31

📥 Commits

Reviewing files that changed from the base of the PR and between 4743306 and 81c5264.

📒 Files selected for processing (1)
  • .flake8

Comment thread .flake8 Outdated
Comment thread .flake8
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get the list of changed files in PR `#4703`
gh pr view 4703 --repo RedHatQE/openshift-virtualization-tests --json files --jq '.files[].path'

Length of output: 8


🏁 Script executed:

#!/bin/bash
# Get the diff for .flake8 to find the first changed line
gh pr diff 4703 --repo RedHatQE/openshift-virtualization-tests -- .flake8

Length of output: 37


🏁 Script executed:

#!/bin/bash
# Get the diff for the PR
gh pr diff 4703 --repo RedHatQE/openshift-virtualization-tests

Length of output: 755


🏁 Script executed:

#!/bin/bash
# Get the PR head commit SHA
gh pr view 4703 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid'

Length of output: 41


🏁 Script executed:

#!/bin/bash
# Post inline review comment on the first changed line of .flake8
gh api \
  --method POST \
  repos/RedHatQE/openshift-virtualization-tests/pulls/4703/reviews \
  --field commit_id="81c52641940e1ad6f2a81bf6d4a9560d0fa53e41" \
  --field event="COMMENT" \
  --field "comments[][path]=.flake8" \
  --field "comments[][position]=4" \
  --field "comments[][body]=**Test Execution Plan**

- **Run smoke tests: False**

This PR modifies only the \`.flake8\` linting configuration file — no Python source code, test files, fixtures, utilities, or conftest files are changed. There are no affected code paths, pytest fixtures, or test dependencies. No tests need to be executed to validate this change."

Length of output: 1735


coderabbitai[bot]
coderabbitai Bot previously approved these changes May 3, 2026
Remove max-line-length (ruff formatter manages line length).

Add ignore rules to .flake8 for two categories:

Rules handled by ruff formatter (ruff removes noqa for these,
causing flake8 CI failures):
- E501: line too long (ruff formatter manages line length)
- E201: whitespace after bracket (ruff formatter manages this)
- W503: line break before binary operator (PEP 8 reversed)
- F821: undefined name (global_config files use dynamic exec())

Intentionally suppressed naming rules (not enforced by either
linter — these patterns are valid in this codebase):
- N815: camelCase in dataclass fields matching K8s API schemas
- N802: method overrides like formatTime from logging.Formatter
- N818: existing exception names like MissingTemplateVariables

Also add with_suffix and writelines to fcn_exclude_functions
to prevent FCN001 false positives on standard library calls.

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: rnetser <rnetser@redhat.com>
@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

Comment thread .flake8
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Post inline review comment on the first changed line of .flake8
gh api \
  --method POST \
  repos/RedHatQE/openshift-virtualization-tests/pulls/4703/reviews \
  --field commit_id="81c52641940e1ad6f2a81bf6d4a9560d0fa53e41" \
  --field event="COMMENT" \
  --field "comments[][path]=.flake8" \
  --field "comments[][position]=4" \
  --field "comments[][body]=**Test Execution Plan**

- **Run smoke tests: False**

This PR modifies only the \`.flake8\` linting configuration — no Python source code, test files, fixtures, utilities, or conftest files are changed. There are no affected code paths, pytest fixtures, or test dependencies. No tests need to be executed to validate this change."

Length of output: 1735


@rnetser
Copy link
Copy Markdown
Collaborator Author

rnetser commented May 3, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@openshift-virtualization-qe-bot-5
Copy link
Copy Markdown

New container for quay.io/openshift-cnv/openshift-virtualization-tests:latest published

rnetser added a commit that referenced this pull request May 4, 2026
…#4720)

##### What this PR does / why we need it:
Adds ignore rules to `pyproject.toml` for ruff preview rules exposed by
`preview = true` that require careful per-file refactoring. Each rule is
marked with a TODO to be addressed in a dedicated follow-up PR.

**Rules ignored:**

| Rule | Description | Why ignored |
|------|-------------|-------------|
| SIM102 | collapsible-if | Nested ifs are often more readable |
| SIM114 | combine if branches | Reduces readability |
| SIM117 | nested with statements | Existing pattern, keep as-is |
| C419 | unnecessary comprehension in call | May change list vs
generator semantics |
| RUF015 | unnecessary iterable allocation | Changes exception type |
| DTZ005/006/007 | datetime without timezone | Requires careful
refactoring |
| BLE001 | blind exception catch | Pre-existing, fix separately |
| PYI034/036 | __enter__/__exit__ annotations | Needs type annotation
work |
| EXE001/002 | shebang/executable mismatch | Needs per-file review |
| F821 | undefined name | Used in global_config files (dynamic loading)
|
| PLE0643 | likely IndexError | Needs per-case review |
| PLW0604 | redundant global at module level | Used in global_config
files |
| PLW1510 | subprocess.run without check | Needs per-call review |
| B005/018/023 | various bugbear rules | Intent-dependent |
| G201 | .error(exc_info=True) vs .exception() | Needs per-call review |
| SIM115 | context manager for file opening | May need structural
changes |

Part 2 of a 6-PR series to clean up lint configuration and apply safe
fixes:
1. `.flake8` ignore rules (#4703)
2. **This PR** — `pyproject.toml` ruff ignore rules
3. Remove stale `# noqa` comments (depends on PRs 1+2)
4. Remove obsolete utf-8 coding headers
5. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
6. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude <noreply@anthropic.com>

##### Which issue(s) this PR fixes:

##### Special notes for reviewer:
No code changes — config only. All pre-commit hooks pass on all files.

##### jira-ticket:


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
  * Updated code linting configuration settings.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: rnetser <rnetser@redhat.com>
rnetser added a commit that referenced this pull request May 4, 2026
##### What this PR does / why we need it:
Two cleanups in one PR:

**1. Remove stale `# noqa` comments** that no linter enforces after
.flake8 (#4703) and pyproject.toml (#4720) configuration changes:

| Rule | Reason noqa is stale |
|------|---------------------|
| F821 | Scoped to `tests/global_config*.py` via ruff `per-file-ignores`
(#4720) |
| N802 | Flake8 no longer checks this (#4703) |
| E501 | Ruff formatter manages line length |
| E201 | Ruff formatter manages whitespace |

**N815 (`camelCase` in class scope) noqa comments are intentionally
kept** — flake8 still enforces N815. The existing `# noqa: N815`
comments on dataclass fields matching Kubernetes API schemas remain in
place. N815 was also **removed from the flake8 ignore list** to restore
enforcement.

`utilities/unittests/` E402 noqa comments are also kept — E402 is not
globally ignored and these files use `sys.path` manipulation before
imports.

**2. Remove obsolete `# -*- coding: utf-8 -*-` headers** — Python 3 uses
UTF-8 by default (PEP 3120), making these headers unnecessary (ruff
UP009).

Part 3 of a 5-PR lint cleanup series:
1. `.flake8` ignore rules (#4703) ✅ merged
2. `pyproject.toml` ruff ignore rules (#4720) ✅ merged
3. **This PR** — remove stale noqa + utf-8 headers
4. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
5. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude <noreply@anthropic.com>

##### Which issue(s) this PR fixes:

##### Special notes for reviewer:
All changes are comment/header removals — zero behavioral changes. N815
enforcement is restored (removed from flake8 ignore list).

##### jira-ticket:


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
  * Removed legacy UTF-8 encoding declarations from test files.
  * Removed redundant linter-suppression comments across codebase.
  * Updated linting configuration to improve code quality standards.

* **Style**
  * Reformatted test assertions for improved readability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: rnetser <rnetser@redhat.com>
acinko-rh pushed a commit to acinko-rh/openshift-virtualization-tests that referenced this pull request May 5, 2026
Ruff v0.15.x handles several rules with better context awareness than
flake8 (dataclass fields, method overrides, formatter-managed line
length). When ruff removes inline `# noqa` comments it considers
unnecessary, flake8 still enforces those rules, causing CI conflicts.

This PR ignores those rules in `.flake8` to prevent conflicts between
the two linters:

- **N815**: camelCase in class scope — ruff understands dataclass fields
matching API schemas
- **N802**: function name should be lowercase — ruff understands method
overrides (e.g. `formatTime`)
- **E501**: line too long — ruff formatter manages line length
- **F821**: undefined name — used in global_config files with dynamic
`exec()` loading
- **E201**: whitespace after `(` — ruff formatter manages whitespace
- **W503**: line break before binary operator — PEP 8 reversed this;
ruff uses W504 (after)
- **N818**: exception name should end with Error — ruff allows existing
names like `MissingTemplateVariables`

Also adds `with_suffix` and `writelines` to `fcn_exclude_functions` to
prevent FCN001 false positives on standard library calls.

Part 1 of a 6-PR series to clean up lint configuration and apply safe
fixes:
1. **This PR** — `.flake8` ignore rules
2. `pyproject.toml` ruff ignore rules for preview rules
3. Remove stale `# noqa` comments (depends on PRs 1+2)
4. Remove obsolete utf-8 coding headers
5. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
6. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude <noreply@anthropic.com>

Replaces RedHatQE#4701 with a smaller, incremental approach.

No code changes — config only. All pre-commit hooks pass on all files.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Chores**
* Updated linting configuration: removed hard line-length enforcement in
favor of centralized formatting, suppressed a targeted set of stylistic
and specific error checks, and added inline notes clarifying that
certain rules (including line-length and whitespace checks) are managed
by the code formatter.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: rnetser <rnetser@redhat.com>
acinko-rh pushed a commit to acinko-rh/openshift-virtualization-tests that referenced this pull request May 5, 2026
…E#4725)

##### What this PR does / why we need it:
Two cleanups in one PR:

**1. Remove stale `# noqa` comments** that no linter enforces after
.flake8 (RedHatQE#4703) and pyproject.toml (RedHatQE#4720) configuration changes:

| Rule | Reason noqa is stale |
|------|---------------------|
| F821 | Scoped to `tests/global_config*.py` via ruff `per-file-ignores`
(RedHatQE#4720) |
| N802 | Flake8 no longer checks this (RedHatQE#4703) |
| E501 | Ruff formatter manages line length |
| E201 | Ruff formatter manages whitespace |

**N815 (`camelCase` in class scope) noqa comments are intentionally
kept** — flake8 still enforces N815. The existing `# noqa: N815`
comments on dataclass fields matching Kubernetes API schemas remain in
place. N815 was also **removed from the flake8 ignore list** to restore
enforcement.

`utilities/unittests/` E402 noqa comments are also kept — E402 is not
globally ignored and these files use `sys.path` manipulation before
imports.

**2. Remove obsolete `# -*- coding: utf-8 -*-` headers** — Python 3 uses
UTF-8 by default (PEP 3120), making these headers unnecessary (ruff
UP009).

Part 3 of a 5-PR lint cleanup series:
1. `.flake8` ignore rules (RedHatQE#4703) ✅ merged
2. `pyproject.toml` ruff ignore rules (RedHatQE#4720) ✅ merged
3. **This PR** — remove stale noqa + utf-8 headers
4. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
5. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude <noreply@anthropic.com>

##### Which issue(s) this PR fixes:

##### Special notes for reviewer:
All changes are comment/header removals — zero behavioral changes. N815
enforcement is restored (removed from flake8 ignore list).

##### jira-ticket:


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
  * Removed legacy UTF-8 encoding declarations from test files.
  * Removed redundant linter-suppression comments across codebase.
  * Updated linting configuration to improve code quality standards.

* **Style**
  * Reformatted test assertions for improved readability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: rnetser <rnetser@redhat.com>
acinko-rh pushed a commit to acinko-rh/openshift-virtualization-tests that referenced this pull request May 5, 2026
Ruff v0.15.x handles several rules with better context awareness than
flake8 (dataclass fields, method overrides, formatter-managed line
length). When ruff removes inline `# noqa` comments it considers
unnecessary, flake8 still enforces those rules, causing CI conflicts.

This PR ignores those rules in `.flake8` to prevent conflicts between
the two linters:

- **N815**: camelCase in class scope — ruff understands dataclass fields
matching API schemas
- **N802**: function name should be lowercase — ruff understands method
overrides (e.g. `formatTime`)
- **E501**: line too long — ruff formatter manages line length
- **F821**: undefined name — used in global_config files with dynamic
`exec()` loading
- **E201**: whitespace after `(` — ruff formatter manages whitespace
- **W503**: line break before binary operator — PEP 8 reversed this;
ruff uses W504 (after)
- **N818**: exception name should end with Error — ruff allows existing
names like `MissingTemplateVariables`

Also adds `with_suffix` and `writelines` to `fcn_exclude_functions` to
prevent FCN001 false positives on standard library calls.

Part 1 of a 6-PR series to clean up lint configuration and apply safe
fixes:
1. **This PR** — `.flake8` ignore rules
2. `pyproject.toml` ruff ignore rules for preview rules
3. Remove stale `# noqa` comments (depends on PRs 1+2)
4. Remove obsolete utf-8 coding headers
5. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
6. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude <noreply@anthropic.com>

Replaces RedHatQE#4701 with a smaller, incremental approach.

No code changes — config only. All pre-commit hooks pass on all files.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Chores**
* Updated linting configuration: removed hard line-length enforcement in
favor of centralized formatting, suppressed a targeted set of stylistic
and specific error checks, and added inline notes clarifying that
certain rules (including line-length and whitespace checks) are managed
by the code formatter.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: rnetser <rnetser@redhat.com>
Signed-off-by: Adam Cinko <acinko@redhat.com>
acinko-rh pushed a commit to acinko-rh/openshift-virtualization-tests that referenced this pull request May 5, 2026
…E#4725)

##### What this PR does / why we need it:
Two cleanups in one PR:

**1. Remove stale `# noqa` comments** that no linter enforces after
.flake8 (RedHatQE#4703) and pyproject.toml (RedHatQE#4720) configuration changes:

| Rule | Reason noqa is stale |
|------|---------------------|
| F821 | Scoped to `tests/global_config*.py` via ruff `per-file-ignores`
(RedHatQE#4720) |
| N802 | Flake8 no longer checks this (RedHatQE#4703) |
| E501 | Ruff formatter manages line length |
| E201 | Ruff formatter manages whitespace |

**N815 (`camelCase` in class scope) noqa comments are intentionally
kept** — flake8 still enforces N815. The existing `# noqa: N815`
comments on dataclass fields matching Kubernetes API schemas remain in
place. N815 was also **removed from the flake8 ignore list** to restore
enforcement.

`utilities/unittests/` E402 noqa comments are also kept — E402 is not
globally ignored and these files use `sys.path` manipulation before
imports.

**2. Remove obsolete `# -*- coding: utf-8 -*-` headers** — Python 3 uses
UTF-8 by default (PEP 3120), making these headers unnecessary (ruff
UP009).

Part 3 of a 5-PR lint cleanup series:
1. `.flake8` ignore rules (RedHatQE#4703) ✅ merged
2. `pyproject.toml` ruff ignore rules (RedHatQE#4720) ✅ merged
3. **This PR** — remove stale noqa + utf-8 headers
4. Apply safe ruff fixes repo-wide (SIM118, SIM201, PLC0206, etc.)
5. Bump pre-commit hooks (ruff v0.15.12, mypy v1.20.2)

Assisted-by: Claude <noreply@anthropic.com>

##### Which issue(s) this PR fixes:

##### Special notes for reviewer:
All changes are comment/header removals — zero behavioral changes. N815
enforcement is restored (removed from flake8 ignore list).

##### jira-ticket:

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
  * Removed legacy UTF-8 encoding declarations from test files.
  * Removed redundant linter-suppression comments across codebase.
  * Updated linting configuration to improve code quality standards.

* **Style**
  * Reformatted test assertions for improved readability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: rnetser <rnetser@redhat.com>
Signed-off-by: Adam Cinko <acinko@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants