8fd08590

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

hopinion and the dangerous functions list

Both judge the Haskell against standards this repository was written to and
had no way of enforcing. Between them they found 53 and 37 things.

hopinion needed routeros-check to be in haskellPackages rather than built
beside it, since what it reads is what the compiler wrote down, and only
the set that builds a package has that. It runs in a nixpkgs of its own so
that nothing it does can change what gets built.

What it found, both of them rules already written down here: strings
concatenated with <> rather than put in a list, and FilePath in this
repository's own signatures. The second is the interesting one. The
reported path is now SomeBase File, which says what FilePath could not:
whether it is absolute or relative. diagnose still wants a String and gets
one at the call, which is what converting at the edge means.

The dangerous functions found four uses of read, which is partial, and
seven of Data.Text.IO.readFile, which decodes by locale. A nix build has
no locale, so a configuration with a comment outside ascii would have
failed to be read there and nowhere else. Both are gone: readMaybe, and a
File module that reads and writes utf-8 whatever the environment says.

hlint and hopinion disagree about strings: one wants ++, the other wants a
list. The list is what this repository has chosen, so that hint is
ignored, with the reason written where the ignore is.

Nothing was suppressed to make either pass.
GitHub
hopinionpre-commitreleaserouteros-checkshellconfiguredevShelldefaultrouteros-checkrouteros-vmtest-selftestx86_64-linux