Warn on unused imports?

Dejan Lekic dejan.lekic at gmail.com
Wed Oct 3 14:27:42 UTC 2018


On Thursday, 27 September 2018 at 18:35:58 UTC, Nick Sabalausky 
(Abscissa) wrote:
> On 09/26/2018 04:37 AM, Dejan Lekic wrote:
>> On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature 
>> wrote:
>>> I'm playing with a branch of DMD that would warn on unused 
>>> imports:
>> 
>> I humbly believe this does not belong to the compiler. These 
>> sort of things belong to a static code analyser TOOL. Think of 
>> checkstyle/findbugs in Java, or flake8/pep8 in Python world.
>
> It amounts to the same thing. What you're talking about 
> ultimately boils down to nothing more than the trivial 
> distinction between:
>
> toolx ...
> toola --do-x ...
>
> And if you still prefer the former, that can be trivially 
> created via shell alias or a one-liner script.
>
> OTOH, If you're talking about whether action X should be taken 
> by default, than that's an entirely orthogonal matter to 
> whether or not it can be included in the compiler.

IDK, I prefer things done in the UNIX way - do one thing and do 
it right. Compiler should do what its name says - COMPILE, while 
some other tool should be made for these kind of code checks. The 
code will compile no matter whether there are some unused imports 
or not, right?


More information about the Digitalmars-d mailing list