Add hlint warning for wrong use of 'length'
authorIustin Pop <iustin@google.com>
Thu, 28 Jun 2012 22:20:05 +0000 (15:20 -0700)
committerIustin Pop <iustin@google.com>
Fri, 29 Jun 2012 17:34:54 +0000 (10:34 -0700)
commit0c76f280a8a82d4f80114b26fb8ee86637efaa37
treed69a48d36df465fe7e0fdb96f570fbae3f7a0540
parentb1a9d630651bb4074999c26cceb8a896dbfcecb4
Add hlint warning for wrong use of 'length'

While removing split instances check from hcheck, I saw a wrong use of
'length': this should only be used when one needs the actual length of
the list, and not when one wants to check whether the list is empty or
not (in that case, 'null' should be used).

To prevent this in the future, let's add a hlint hint for it, and fix
the warning it generates in hbal.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
htools/Ganeti/HTools/Program/Hbal.hs
htools/lint-hints.hs