I was wondering if there is a way (probably a tool or a package) that could show whether an import, an export or a using statement is useless in a particular source file. Particularly,
using X: Type1, Type2, foo1, foo2 # are these really used?
import Y: Type3, zee1, zee2 # are these really extended here
export Type3, gaa1, gaa2, # are these still there
Something like that would be great for maintaining the set of employed, extended and exported modules, types and functions in an incremental development process.
Sorry to resurrect this old topic but I noted a corner case:
Imagine that in MyPkg.jl I do a
using Printf: @printf
and the remove would incorrectly (at least to me) suggest to remove Printf. Any way to programmatically check for unused deps?
I don’t think that it is possible to detect “useless”
exports, though. Exported symbols are meant to be used by “others”, not by the source.
Here I mean exports that are neither defined nor implemented.
Edit: I noticed that the package Aqua.jl apparently does that
Edit2: Please let me know if I should delete this thread?
No, don’t delete it; it will increase the chances for another person with the same problem to find the solution. If you think that it is solved, what you can do is to mark the corresponding answer as “Solution”, so that it will be more visible to other readers.
Isn’t a warning issued in these cases?
Threads should almost never be deleted. There would have to be strong reasons, and even though you can delete your own posts, you cannot delete a thread yourself.
If a thread simply isn’t very useful, it will just quietly sink to the bottom of the front page, and eventually be forgotten.