Skip to content

Add dependency analysis tooling to identify unused Python files and folders#241

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/analyze-unused-files-folders
Draft

Add dependency analysis tooling to identify unused Python files and folders#241
Copilot wants to merge 4 commits intomainfrom
copilot/analyze-unused-files-folders

Conversation

Copy link

Copilot AI commented Feb 2, 2026

Analyzes repository to identify code never imported from 23 defined entry points. Found 214 unused files (77.3%) and 28 completely unused folders across 277 total Python files.

Implementation

analyze_unused_files.py - AST-based dependency tracer

  • Parses entry points to extract import statements (absolute, relative, package imports)
  • Resolves imports to file paths with partial path matching for flexible module resolution
  • Recursively builds complete dependency graph via DFS traversal
  • Outputs unused files/folders in TXT and JSON formats

run_analysis.py - Quick runner showing summary statistics

Documentation

  • UNUSED_FILES_ANALYSIS.md - Methodology, recommendations, limitations
  • ANALYSIS_SUMMARY.md - Executive summary with key findings

Key Findings

Top unused folders:

  • md_core_helps/one_time/* - Archived project folders (WHOem, niosh, priorviews)
  • copy_text/, fix_use/, md_core/stats/ - Unused bot/utility modules
  • */tests/ folders for unused modules

Usage rate: 63 files used (22.7%), 214 unused (77.3%)

Usage

# Quick summary
python run_analysis.py

# Full analysis with detailed reports
python analyze_unused_files.py

Generated reports (unused_files_report.{txt,json}) excluded via .gitignore - regenerated on each run.

Notes

  • 2 specified entry points not found: mass/radio/cases_in_ids.py, mass/radio/st3/count.py
  • Excludes newupdater/ folder as requested
  • Dynamic imports (via importlib, exec) not detected by static analysis

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 2, 2026 05:38
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze code repository for unused files and folders Add dependency analysis tooling to identify unused Python files and folders Feb 2, 2026
Copilot AI requested a review from MrIbrahem February 2, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants