Remove dead code and unnecessary global declarations#396
Merged
Conversation
|
Merging to
|
…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
|
👋 Development Partner is reviewing this PR. Will provide feedback shortly. |
There was a problem hiding this comment.
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_tablefunction definition (148 lines) that was shadowed by a second definition - Removed unreachable
return Truestatements invalidate_hostnameandvalidate_folder_url - Removed unnecessary
globaldeclarations from 7 functions where only dictionary mutations occur (not reassignments) - Removed unused exception variable from bare re-raise pattern
|
👋 Development Partner is reviewing this PR. Will provide feedback shortly. |
abhimehro
approved these changes
Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Static analysis (pyflakes) surfaced several dead-code and style issues across
main.py. This PR cleans them up.Dead / unreachable code
print_summary_tabledefinition (the 148-line version at line 316): it was immediately shadowed by a second definition at line 2358 and never called by either name.return Trueinvalidate_hostname: placed after the innerexceptblock that already unconditionally returns.return Trueinvalidate_folder_url: placed after a try-except where every branch returns explicitly.Unnecessary
globaldeclarationsglobalis 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_cache—global _cache_stats(keptglobal _disk_cache, which is reassigned)_parse_rate_limit_headers—global _rate_limit_info_api_get,_api_delete,_api_post,_api_post_form—global _api_stats_gh_get—global _cache_stats, _api_statsmain—global _disk_cache(only.clear()is called, no reassignment)Unused exception variable
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.