Thread overview
How to get warnings about unused imports ?
Jul 02, 2013
Gabi
Jul 03, 2013
Namespace
Jul 03, 2013
Gabi
Jul 03, 2013
Namespace
July 02, 2013
Hi,

How to find unused imports ?

It seems the compiler doesn't do it, but is there any other tool for that?
This seems like small issue, but those unused imports pile up pretty quickly

Regards,
Gabi
July 03, 2013
On Tuesday, 2 July 2013 at 21:49:37 UTC, Gabi wrote:
> Hi,
>
> How to find unused imports ?
>
> It seems the compiler doesn't do it, but is there any other tool for that?
> This seems like small issue, but those unused imports pile up pretty quickly
>
> Regards,
> Gabi

I'm working on something like that for a few days. It is still not completely finished, but it works so far. But currently only for named imports. Everything else was far too much work for me.

https://github.com/Dgame/SimpleDAT
July 03, 2013
On Wednesday, 3 July 2013 at 06:12:46 UTC, Namespace wrote:
> On Tuesday, 2 July 2013 at 21:49:37 UTC, Gabi wrote:
>> Hi,
>>
>> How to find unused imports ?
>>
>> It seems the compiler doesn't do it, but is there any other tool for that?
>> This seems like small issue, but those unused imports pile up pretty quickly
>>
>> Regards,
>> Gabi
>
> I'm working on something like that for a few days. It is still not completely finished, but it works so far. But currently only for named imports. Everything else was far too much work for me.
>
> https://github.com/Dgame/SimpleDAT

This is great. Maybe point me to the right direction how to implement finding unnamed imports too ? It could be great exercise for me to learn D :)
July 03, 2013
You have to parse the unnamed import files, list all their identifiers (global variables, public functions etc.) and search for them. ;)
That could be a bit complicated. ;) Therefore I don't want to do it. Even with named imports you can get false positives.

But if you like it, you could improve it. The Lexer is my own and not that good, that would be start. On the wiki you can find other Lexer / Parsers, which are really good, but I haven't the time to replace my own and adapt the source or to work much on the project.