[Bug] Symfony Console commands and EventSubscribers are reported as unused exports

Open
#6,300 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@rishu685 is already working on this.

Since Nov 26, 2026.

  • #6327 by @rishu685 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php
Domain
devtools

Research direction

Start with ingestion/framework_edges/laravel.py as the model for a new Symfony handler, and find where SYMFONY is defined in ingestion/framework_facts.py (around lines 85-87). Check the *Command pattern in analysis/dead_code/constants.py near line 1138 to see what it misses. Done means classes extending Symfony's Command or implementing EventSubscriberInterface become roots, while Plain and a local non-Symfony Command stay flagged, as covered by a new tests/unit/dead_code/test_symfony_liveness.py.

Written by the indexing model from the issue text.

Description

bug help wanted

Summary

A class extending Symfony's Console Command or implementing EventSubscriberInterface is loaded by the container or a command loader, never imported, so it is reported as an unused_export and an unreachable_file. Laravel has liveness edges; Symfony has only detection facts.

packages/core/src/repowise/core/ingestion/framework_facts.py:85-87

SYMFONY = FrameworkFacts(
    name="Symfony",
    composer_packages=("symfony/framework-bundle", "symfony/symfony"),

Mechanism

  • ingestion/framework_edges/ holds laravel.py and typo3.py for PHP and nothing for Symfony.
  • The only name-based help is the *Command dynamic pattern (analysis/dead_code/constants.py:1138), which misses a command class not named ...Command and every subscriber.
  • Detection is the wrong gate: an app can use symfony/console alone, without symfony/framework-bundle, so composer_packages misses it. The class shape is the signal: extends Command or implements EventSubscriberInterface, resolved to the Symfony\Component\... import.

Repro

composer.json        require symfony/console, symfony/event-dispatcher; psr-4 "Acme\\": "src/"
src/Cmd/Hello.php    use Symfony\Component\Console\Command\Command; class Hello extends Command { execute(...) }
src/Events/Sub.php   use Symfony\Component\EventDispatcher\EventSubscriberInterface; class Sub implements EventSubscriberInterface { getSubscribedEvents() }
src/Util/Plain.php   class Plain {}   (control)

repowise init --mode fast --no-prose, then repowise dead-code --format json on main:

unused_export src/Cmd/Hello.php Hello 0.6
unused_export src/Events/Sub.php Sub 0.6
unused_export src/Util/Plain.php Plain 0.6
unreachable_file src/Cmd/Hello.php  0.4
unreachable_file src/Events/Sub.php  0.4
unreachable_file src/Util/Plain.php  0.4

Impact

Symfony apps and CLIs with many commands or subscribers get a long false-positive list.

Done looks like

  • Classes extending Symfony's Command or implementing its EventSubscriberInterface become reachability roots, in a handler beside laravel.py.
  • Plain stays flagged, and so does a class extending a local Command that is not Symfony's.
  • Decide whether #[AsCommand] and #[AsEventListener] attributes count too.
  • Help wanted: needs import-resolved base-class matching and that attribute decision.

Tests

A new tests/unit/dead_code/test_symfony_liveness.py, modelled on test_laravel_liveness.py, with the three classes above.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.