This might be nice. If it's not already there somewhere, it would be great to have useless variable names like %data or rampant single letter names flagged as sub-optimal.
| [reply] [d/l] |
Except as loop indices or as part of mathematical functions such as if ($x^2 + $y^2 == $z^2) { ... }. And, useless variables are only useless outside of context. %data might be perfectly acceptable in a properly-named function.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] [d/l] |
I think the same kind of context heuristics used for single letter names could be extended to names like %tmp, %arg, and %data (or reaonsable single letters for cases like $c/$f/$k in a temperature sub). Check their scope. They are pretty reasonable in a small loop but I'd argue that in a main:: space or a block/sub longer than...? 10? lines, they could be named better and a critic rule might suggest that. Normally when I find myself using that kind of name it's out of haste and I wouldn't mind an automated kick in the pants to make me stop for 90 seconds to think about how it will really read to the next hacker (or to me in 6 months).
| [reply] |
This looks good. But I'm wieghing up the time it'll take to understand Perl::Critic to putting a qnd script together. | [reply] |