GNU bug report logs - #61266
[PATCH 1/1] lint: Add unused-modules linter.

Previous Next

Package: guix-patches;

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

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

Severity: normal

Tags: patch

Merged with 61265

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#61265: closed ([PATCH 0/1] Add lint checker for unused module
 imports.)
Date: Mon, 20 Feb 2023 10:54:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 20 Feb 2023 11:53:45 +0100
with message-id <87zg98ip52.fsf <at> gnu.org>
and subject line Re: bug#61266: [PATCH 1/1] lint: Add unused-modules linter.
has caused the debbugs.gnu.org bug report #61266,
regarding [PATCH 0/1] Add lint checker for unused module imports.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
61266: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61266
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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(-)



[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Reily Siegel <mail <at> reilysiegel.com>
Cc: 61266-done <at> debbugs.gnu.org
Subject: Re: bug#61266: [PATCH 1/1] lint: Add unused-modules linter.
Date: Mon, 20 Feb 2023 11:53:45 +0100
Hi Reily,

Reily Siegel <mail <at> reilysiegel.com> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> I have just submitted a patch adding a ‘-Wunused-module’ warning to
>> Guile’s compiler, which avoids these issues:
>>
>>   https://lists.gnu.org/archive/html/guile-devel/2023-02/msg00026.html
>>
>> I wonder if we should stick to that and avoid having a lint warning
>> altogether.  WDYT?
>
> This is probably a much more workable approach. Another problem with
> lint checkers that I forgot to mention in my initial patch is that they
> are really designed to work on packages, not files.

Alright, I’m closing this issue but let’s reopen it if we eventually
change our mind.

Thanks for looking into this!

Ludo’.


This bug report was last modified 2 years and 153 days ago.

Previous Next


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