lint for D
Bruce Adams
tortoise_74 at yeah.who.co.uk
Thu Jul 10 01:33:41 PDT 2008
On Thu, 10 Jul 2008 02:44:07 +0100, Ary Borenszweig <ary at esperanto.org.ar>
wrote:
> Bruce Adams a écrit :
>> Hi all,
>> Alas this is not an announcement. It should be relatively easy
>> to knock up a few noddy scripts that can detect some kinds
>> of potential problem.
>
> It should be relatively easy to write a plugin for Descent to do that.
> Something similar to FindBugs for Java (
> http://findbugs.sourceforge.net/ ). Given a source file, you can ask
> Descent for it's AST with complete type resolution. You can apply the
> visitor pattern, which is supported by the AST nodes. You can store in a
> list which variables are declared, and then if they are used in a
> function or are written too, you eliminate them. The remaining entries
> in the list are the unused variables. It's a little harder for
> class/struct members, but it's still relatively easy.
>
> It is both helpful for a developer and for Descent, because the code
> that support that is kind of finished, but it isn't tested much (it's
> only used in highlighting code, which seems to work fine). Of course I
> could do that, but atm I'm adding support for D2, plus it would be
> interesting if anyone else could join the project.
This is a pet hate of mine. Tool should not be plug-ins for IDEs.
Not unless there is a way to run them as stand alone tools in your
automated build process when the IDE is not running.
I much prefer the idea of a clever command line tool. You can then have a
plug-in
that wraps it. I realise this means you can't take advantage of all the
IDEs
features but to me that is evidence that those features belong in a shared
library
and not as part of the IDE itself. Eclipse is notorious for this.
That said, if your IDE has a way to run plug-ins without loading the
entire envrionment
then it can still act like a command line tool and be built into whatever
build scripts
you desire.
I still think the separation is important. Otherwise you may update your
plug-in to do
something clever like jump to line X and open the help for it which will
make the command
line equivalent choke. Much better if the IDE groks the output of the tool
and its
in a compiler friendly format giving the file and line numbers.
Regards,
Bruce.
More information about the Digitalmars-d
mailing list