Skip to content

[CHORE]: Add vulture (dead code detect) and unimport (unused import detect) to Makefile and GitHub Actions #305

@crivetimihai

Description

@crivetimihai

🔧 Chore Summary

Add vulture (dead code detection) and unimport (unused import detection) to the Makefile linting suite to help identify and remove unused code like the suspected manager.py file.


🧱 Area Affected

  • Pre-commit hooks / linters
  • Build system or Makefile
  • Dependency cleanup or updates

⚙️ Context / Rationale

During code review, we identified potential dead code (specifically manager.py with FederationManager class) that appears to be duplicated by gateway_service.py. To systematically identify and clean up unused code throughout the codebase:

  1. vulture - Finds unused code (classes, functions, variables) that can be safely removed
  2. unimport - Detects unused imports that create false dependencies and clutter

This will:

  • Reduce technical debt by identifying dead code
  • Improve code maintainability and clarity
  • Reduce bundle size and dependency overhead
  • Provide ongoing monitoring for unused code introduction

📦 Related Make Targets

  • make lint - run full linting suite (vulture/unimport will be added here)
  • make vulture - new target for dead code detection
  • make unimport - new target for unused import detection
  • make install - will need to include new dependencies

📋 Acceptance Criteria

  • Add vulture and unimport to project dependencies
  • Create individual vulture and unimport make targets following existing patterns
  • Add both tools to the LINTERS variable in Makefile
  • Add help documentation for new targets
  • Configure appropriate confidence levels and exclusions
  • Linter runs cleanly (make lint)
  • CI passes with no regressions
  • Document any configuration files needed (.vulture, .unimport.cfg)

🧩 Additional Notes

Proposed Makefile additions:

# Add to LINTERS variable:
LINTERS := isort flake8 pylint mypy bandit pydocstyle pycodestyle pre-commit \
           ruff pyright radon pyroma pyrefly spellcheck importchecker \
           pytype check-manifest markdownlint vulture unimport

# Add help entries:
# help: vulture              - Dead code detection
# help: unimport             - Unused import detection

# Add individual targets:
vulture:                            ## 🧹  Dead code detection
	@echo "🧹  vulture …" && $(VENV_DIR)/bin/vulture mcpgateway --min-confidence 80

unimport:                           ## 📦  Unused import detection  
	@echo "📦  unimport …" && $(VENV_DIR)/bin/unimport --check --diff mcpgateway

Dependencies to add:

  • vulture>=2.10.0
  • unimport>=0.16.0

Configuration considerations:

  • vulture may need a .vulture whitelist file for false positives
  • unimport can be configured via pyproject.toml if needed
  • Initial run should use --min-confidence 80 for vulture to reduce noise

Metadata

Metadata

Assignees

Labels

choreLinting, formatting, dependency hygiene, or project maintenance chorescicdIssue with CI/CD process (GitHub Actions, scaffolding)devopsDevOps activities (containers, automation, deployment, makefiles, etc)good first issueGood for newcomershelp wantedExtra attention is neededtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions