ctl
ctl copied to clipboard
Feature request: dead module / file detection
One aspect of a large codebases is the potential for files to simply never be included in the build in the first place. This macro doesn't pick those up, obviously, because they aren't part of the build. However, "dead module detection" is arguably as useful as "dead code detection."
Thought 1) Perhaps an easy way would be using the Compiler include macro for "all packages", maybe:
--macro include('')
But this actually doesn't work... It seems to be implying -cp . as it results in "invalid package" errors...
Thought 2) Perhaps another idea is to actually glob from all source paths in TCell.hx, and report unused modules / files from there.
Thought 3) Just mention in the README, this doesn't pick up types that are never referenced.
I can add an option to let the macro scan all classpaths and report any modules that the compiler doesn't see.
One of the potential problem of --macro include is that it forces the compiler to compile all those dead/orphan class which in turn forces the user to fix all the compiler error there. That is not desirable I suppose.
it forces the compiler to compile all those dead/orphan class which in turn forces the user to fix all the compiler error there.
Well, I think that's the goal: to make the user fix or eliminate (or minimally, aware of) his dead code. But this is probably best optional -- in case it's a daunting task.
In that case, you don't need this library?
@kevinresol - I feel like we're not communicating well via these comments, but that we're actually in agreement. :+1: I'm merely saying:
An option to scan and include all orphan modules would complement this library (and its goal of code cleanup) nicely. Perhaps not as the default, as that could overwhelm the user on the first try, but certainly as an option.