GNU bug report logs - #61265
[PATCH 0/1] Add lint checker for unused module imports.

Previous Next

Package: guix-patches;

Reported by: Reily Siegel <mail <at> reilysiegel.com>

Date: Sat, 4 Feb 2023 06:45:02 UTC

Severity: normal

Tags: patch

Merged with 61266

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61265 in the body.
You can then email your comments to 61265 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#61265; Package guix-patches. (Sat, 04 Feb 2023 06:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reily Siegel <mail <at> reilysiegel.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 04 Feb 2023 06:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reily Siegel <mail <at> reilysiegel.com>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/1] Add lint checker for unused module imports.
Date: Sat, 4 Feb 2023 01:42:28 -0500
Julien Lepiller <julien <at> 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(-)





Merged 61265 61266. Request was from Liliana Marie Prikler <liliana.prikler <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 04 Feb 2023 07:38:02 GMT) Full text and rfc822 format available.

Merged 61265 61266. Request was from Leo Famulari <leo <at> famulari.name> to control <at> debbugs.gnu.org. (Sun, 05 Feb 2023 13:09:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#61265; Package guix-patches. (Sun, 05 Feb 2023 13:10:01 GMT) Full text and rfc822 format available.

Message #12 received at 61265 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Reily Siegel <mail <at> reilysiegel.com>
Cc: 61265 <at> debbugs.gnu.org
Subject: Re: [bug#61265] [PATCH 0/1] Add lint checker for unused module
 imports.
Date: Sun, 5 Feb 2023 14:09:16 +0100
On Sat, Feb 04, 2023 at 01:42:28AM -0500, Reily Siegel wrote:
> 
> Julien Lepiller <julien <at> 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:

Nice!

Off-topic, if you are sending a patch series, be sure to follow the
instructions in the manual section Sending a Patch Series:

https://guix.gnu.org/manual/devel/en/html_node/Sending-a-Patch-Series.html

Otherwise, the ticketing system creates a new ticket for each patch,
like here. Don't worry, I've merged the ticket.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Mar 2023 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.