unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#61265] [PATCH 0/1] Add lint checker for unused module imports.
@ 2023-02-04  6:42 Reily Siegel
  2023-02-05 13:09 ` Leo Famulari
  0 siblings, 1 reply; 2+ messages in thread
From: Reily Siegel @ 2023-02-04  6:42 UTC (permalink / raw)
  To: 61265


Julien Lepiller <julien@lepiller.eu> writes (guix-devel):

> Many modules seem to use a lot of imports that are actually useless,
> for instance (gnu packages heads) imports 20 package modules, but
> only uses 4 of them.
>
> Removing these module imports would help a lot with reducing the number
> of loops. If anyone wants to volunteer a lint checker for that,
> raise hands :D

This is a quick and dirty implementation of such a lint checker. It
compares the symbols used in a module to those provided by its
dependencies. If there is a dependency for which none of the symbols
overlap, a warning is reported. A potential downside of this approach is
that the lint checker cannot distinguish between lexically scoped
variables and variables which actually reference another module. This
has two effects:

- The implementation is slower, because lexically bound variables must
  also be checked
- The implementation may fail to report an unused import if a lexical
  binding with the same name as one of the module's exports is used

However, this does vastly simplify the implementation.


Reily Siegel (1):
  lint: Add unused-modules linter.

 guix/lint.scm | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-05 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04  6:42 [bug#61265] [PATCH 0/1] Add lint checker for unused module imports Reily Siegel
2023-02-05 13:09 ` Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).