On Thu, Aug 6, 2009 at 10:41 AM, Jason Dagit<[email protected]> wrote:
>
>
> On Thu, Aug 6, 2009 at 3:31 AM, Gwern Branwen <[email protected]> wrote:
>>
>> (I note that error will lead to a non-zero exit code; glad to see that
>> issue fixed.)
>>
>> Now, attached is a patch adding this hint file, and also adding your basic
>> sh script running hlint with 2 args (the hint file and ../src).
>>
>> My patch doesn't also replace haskell_policy.sh because there are so many
>> warnings and not a few errors in the darcs codebase, so while
>> haskell_policy.sh might exit with 0 right now, haskell_hlint.sh most
>> certainly won't! And I hesitate to take the step of 'breaking' part of the
>> testing infrastructure.
>
> Gwern,
>
> Thanks for doing this.  I was reading the comments in your message and I
> wondered if it would be possible to add a rule to disallow the lazy
> bytestring variant of readFile?  The comment says it's just as problematic
> as the prelude version.
>
> Thanks!
> Jason

So something like this?

[02:49 PM] 0Mb$ cat foo.hs && echo
import Data.ByteString.Lazy as B
import Data.ByteString.Lazy.Char8 as C

main = do f <- B.readFile "foo"
          f' <- C.readFile "foo"
          return ()
[02:49 PM] 0Mb$ new
hunk ./tests/darcs-custom.hint 17
+error "Data.ByteString.Lazy.readFile doesn't ensure file is closed
before is deleted\nConsider import Data.ByteString.Char8 as B
(readFile instead" = Data.ByteString.Lazy.readFile ==>
Data.ByteString.readFile
+error "Data.ByteString.Lazy.Char8.readFile doesn't ensure file is
closed before is deleted\nConsider import Data.ByteString.Char8 as B
(readFile instead" = Data.ByteString.Lazy.Char8.readFile ==>
Data.ByteString.readFile
[02:49 PM] 0Mb$ hlint --hint=tests/darcs-custom.hint foo.hs
foo.hs:4:13: Error: Data.ByteString.Lazy.readFile doesn't ensure file
is closed before is deleted
Consider import Data.ByteString.Char8 as B (readFile instead
Found:
  B.readFile
Why not:
  Data.ByteString.readFile

foo.hs:5:14: Error: Data.ByteString.Lazy.Char8.readFile doesn't ensure
file is closed before is deleted
Consider import Data.ByteString.Char8 as B (readFile instead
Found:
  C.readFile
Why not:
  Data.ByteString.readFile

Found 2 suggestions (2 errors)


-- 
gwern
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to