kibit icon indicating copy to clipboard operation
kibit copied to clipboard

Rule to forbid redefinition of same Var with def

Open AhmedAzzabi opened this issue 7 years ago • 2 comments

How can I add a rule to get warnings when I bind the same var more than once? Is this possible with kibit? This is very useful especially for functions.

AhmedAzzabi avatar Feb 27 '18 18:02 AhmedAzzabi

Hey @AhmedAzzabi, if I understand your question correctly, you're asking if Kibit can detect def f "after" def f? I think the short answer is not at present, although you could probably write such an analysis. One thing to keep in mind here is that the declare macro is generally considered good style, and the defonce macro also does some interesting things with def. So it's not actually sufficient to know that there exist multiple defs of a given var because that quite probably is fine.

What particular behavior are you trying to detect? Can you give us an example?

arrdem avatar Feb 27 '18 19:02 arrdem

This might be a better rule for Eastwood than Kibit also?

danielcompton avatar Feb 27 '18 23:02 danielcompton