From: Pratyush Yadav <me@yadavpratyush.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/1] git-gui: remove unused global declarations
Date: Wed, 30 Oct 2019 00:39:34 +0530 [thread overview]
Message-ID: <20191029190934.mr73g3ohwtgmndoo@yadavpratyush.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1910281412300.46@tvgsbejvaqbjf.bet>
On 28/10/19 02:15PM, Johannes Schindelin wrote:
> Hi Pratyush,
>
> On Fri, 25 Oct 2019, Pratyush Yadav wrote:
>
> > A lot of places have unused global variables declared. Remove them.
> >
> > It started as a couple of quick fixes and ended up in me writing an ugly
> > hacky script to catch all the instances of unused global declarations.
> > Lot more than I expected.
> >
> > The script can be found at [0].
>
> Wouldn't it make more sense to integrate that script into a Makefile
> target `check`, rather than hiding it in a gist (that might become
> unavailable if GitHub goes away, as some of you seem to fear)?
The idea of the script was just a quick hack to list as many instances
as possible, and then I could manually verify them. It turned out to be
pretty accurate. I linked it here so other people can know what I used
to find these, and can suggest some cases I missed, if any. That's why I
linked to the script in the cover letter, and not in the commit message.
It would probably be a better idea to use a linter/static analyzer. This
would provide much better coverage than a script written for one-off
usage.
I looked up some linters. There doesn't seem to be a lot of options, and
most of them are not very good. One option I found is [0], but it gives
more useless warnings than useful ones. Tcl being a really difficult
language to lint doesn't help. So unless someone knows a good Tcl
linter, maybe the best compromise would be to clean up the script and
add it to our build process. But I'd really prefer a "proper" linter.
> > The script at [0] will only catch the unused globals in 'proc's. But
> > git-gui also has 'method's and 'constructor's. Just change '^proc' to
> > '^constructor' or '^method'.
>
> Why not use `grep -E -n -e '^(proc|method)'`?
No particular reason. I just wrote it for 'proc', and then realized I
might as well check 'method' and 'constructor'. Like I said, the aim of
the script was use-and-throw.
> > I manually checked each instance before removing just to be sure I'm not
> > doing something wrong. Still, a bit of testing would be appreciated.
> > Just apply this patch and go on about your business as usual. There
> > _should_ be no change in the behaviour. I tested some basic functions
> > like commit, push, etc, and they work fine for me.
>
> I would, if I used Git GUI regularly ;-)
[0] https://github.com/Xilinx/XilinxTclStore/blob/master/support/linter/tcl_lint.tcl
--
Regards,
Pratyush Yadav
prev parent reply other threads:[~2019-10-29 19:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 1:32 [PATCH 0/1] git-gui: remove unused global declarations Pratyush Yadav
2019-10-25 1:32 ` [PATCH 1/1] " Pratyush Yadav
2019-10-25 3:54 ` Junio C Hamano
2019-10-29 21:32 ` Pratyush Yadav
2019-10-28 13:15 ` [PATCH 0/1] " Johannes Schindelin
2019-10-29 19:09 ` Pratyush Yadav [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191029190934.mr73g3ohwtgmndoo@yadavpratyush.com \
--to=me@yadavpratyush.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).