Skip to content

chore: fix ruff violations F841, F811, E741 in main.py#394

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/improve-code-quality-agent
Closed

chore: fix ruff violations F841, F811, E741 in main.py#394
Copilot wants to merge 3 commits intomainfrom
copilot/improve-code-quality-agent

Conversation

Copy link

Copilot AI commented Feb 20, 2026

Three ruff-detected code quality violations in main.py that were flagged by the automated code quality agent.

Changes

  • F841 — Drop unused binding e from a bare-reraise handler:

    # before
    except httpx.HTTPStatusError as e:
        raise
    # after
    except httpx.HTTPStatusError:
        raise
  • F811 + E741 — Remove the second, never-called print_summary_table definition (formerly ~lines 2358–2397). It shadowed the primary definition at line 316 and was dead code — the summary table is rendered inline in main(). The removed block also contained an inner helper def line(l, m, r) whose l parameter triggered E741 (ambiguous name, visually indistinguishable from 1).

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Discussion Task Miner - Code Quality Improvement Agent - Issue Group</issue_title>
<issue_description># Discussion Task Miner - Code Quality Improvement Agent

Parent issue for grouping related issues from Discussion Task Miner - Code Quality Improvement Agent.

Sub-issues are automatically linked below (max 64 per parent).

Workflow: Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 17, 2026, 5:31 AM UTC</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Development Partner
The Development Partner Protocol


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@trunk-io
Copy link

trunk-io bot commented Feb 20, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

Copilot AI and others added 2 commits February 20, 2026 03:38
Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve code quality for discussion task miner chore: fix ruff violations F841, F811, E741 in main.py Feb 20, 2026
Copilot AI requested a review from abhimehro February 20, 2026 03:42
@abhimehro abhimehro marked this pull request as ready for review February 22, 2026 10:09
Copilot AI review requested due to automatic review settings February 22, 2026 10:09
@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Cleans up ruff-reported lint issues in main.py (unused exception binding and duplicate function definition) and updates the Python dependency lockfile to reflect dev dependencies.

Changes:

  • Remove unused exception binding in _gh_get (except httpx.HTTPStatusError as eexcept httpx.HTTPStatusError).
  • Delete the duplicate (shadowing) print_summary_table definition near the entry-point section.
  • Update uv.lock to include pytest-benchmark (and transitive py-cpuinfo) under dev dependencies.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
main.py Fixes ruff violations by removing an unused exception binding and deleting a duplicate dead-code function definition.
uv.lock Brings the lockfile in sync with dev dependencies by adding pytest-benchmark and py-cpuinfo.


except httpx.HTTPStatusError as e:
except httpx.HTTPStatusError:
# Re-raise with original exception (don't catch and re-raise)
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

This comment is contradictory: it says “don't catch and re-raise”, but the code is explicitly catching HTTPStatusError and re-raising it. Consider rewording to clarify the intent (e.g., that the exception is intentionally propagated unchanged / without wrapping).

Suggested change
# Re-raise with original exception (don't catch and re-raise)
# Intentionally propagate HTTPStatusError unchanged (no wrapping or swallowing)

Copilot uses AI. Check for mistakes.
_cache_stats["misses"] += 1

except httpx.HTTPStatusError as e:
except httpx.HTTPStatusError:

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

The except handler raises immediately Note

The except handler raises immediately
_cache_stats["misses"] += 1

except httpx.HTTPStatusError as e:
except httpx.HTTPStatusError:

Check warning

Code scanning / Prospector (reported by Codacy)

The except handler raises immediately (try-except-raise) Warning

The except handler raises immediately (try-except-raise)
@abhimehro
Copy link
Owner

Closing: merge conflicts + subsumed by #396 dead-code removal.

@abhimehro abhimehro closed this Feb 28, 2026
@abhimehro abhimehro deleted the copilot/improve-code-quality-agent branch February 28, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Discussion Task Miner - Code Quality Improvement Agent - Issue Group

3 participants