Is there a way to easily identify useless import, export and using statements

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.

Related:

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.

1 Like

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.

1 Like

Isn’t a warning issued in these cases?

Apparently no

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.

1 Like