Skip to content

Remove dead code and unnecessary global declarations#396

Merged
abhimehro merged 2 commits intomainfrom
copilot/improve-code-quality-agent-again
Feb 28, 2026
Merged

Remove dead code and unnecessary global declarations#396
abhimehro merged 2 commits intomainfrom
copilot/improve-code-quality-agent-again

Conversation

Copy link

Copilot AI commented Feb 20, 2026

Static analysis (pyflakes) surfaced several dead-code and style issues across main.py. This PR cleans them up.

Dead / unreachable code

  • Removed first print_summary_table definition (the 148-line version at line 316): it was immediately shadowed by a second definition at line 2358 and never called by either name.
  • Removed unreachable return True in validate_hostname: placed after the inner except block that already unconditionally returns.
  • Removed unreachable return True in validate_folder_url: placed after a try-except where every branch returns explicitly.

Unnecessary global declarations

global is only required in Python when reassigning a module-level name. All flagged sites only mutated dict entries, making the declarations pure noise. Removed from:

  • load_disk_cacheglobal _cache_stats (kept global _disk_cache, which is reassigned)
  • _parse_rate_limit_headersglobal _rate_limit_info
  • _api_get, _api_delete, _api_post, _api_post_formglobal _api_stats
  • _gh_getglobal _cache_stats, _api_stats
  • mainglobal _disk_cache (only .clear() is called, no reassignment)

Unused exception variable

# Before
except httpx.HTTPStatusError as e:
    raise  # e never referenced

# After
except httpx.HTTPStatusError:
    raise
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 21, 2026, 5:44 AM UTC</issue_description>

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

Custom agent used: Development Partner
The Development Partner Protocol


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@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.

…arations

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve code quality for discussion task miner Remove dead code and unnecessary global declarations Feb 20, 2026
Copilot AI requested a review from abhimehro February 20, 2026 03:43
@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

This PR removes dead code and unnecessary global declarations identified by static analysis (pyflakes) in main.py. The changes eliminate unreachable code, clean up unnecessary global variable declarations, and remove an unused exception variable, improving code quality without altering functionality.

Changes:

  • Removed dead print_summary_table function definition (148 lines) that was shadowed by a second definition
  • Removed unreachable return True statements in validate_hostname and validate_folder_url
  • Removed unnecessary global declarations from 7 functions where only dictionary mutations occur (not reassignments)
  • Removed unused exception variable from bare re-raise pattern

@github-actions
Copy link

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

@abhimehro abhimehro merged commit 0336871 into main Feb 28, 2026
49 checks passed
@abhimehro abhimehro deleted the copilot/improve-code-quality-agent-again branch February 28, 2026 07:50
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