I have just started using sklint to try to find errors or less than efficient code. I have a couple questions to anyone that knows it's ins and outs:
I keep getting a WARN (VAR16) telling me that the declaration of a variable has been superceeded when the variable was declared as local (using a let or prog). Does this mean a variable in a "for" block is automatically local to that "for" block? Or is it just an error in sklint and it should still be declared as local?As an example, I get the warning "declaration of variable i supercedes previous declaration when I run this snippett through sklint:(let (i) (for i 1 10 (printf "%s\n" i) ))
To add insult to injury, it only gives me an IQ score of 80, even though I am following programming methods!!! :)
Thanks in Advance :)
The "loop" variable in a for loop does not need to be explicitly declared in a let statement since it is implicitly declared as a local variable within the scope of the for command. The same applies to foreach, setof, forall and exists statements.So in this case, sklint warns that the "i" in the let is not needed (or if it is used elsewhere, it is not the same as the "i" within the scope of the for command). The i in the for loop is distinct from the i of the let statement.
In your case, you do not need to declare i in the let statement, and this should get you back towards a score of 100.