e1d3e181

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

Committer: Tom Sydney Kerckhove <NorfairKing@users.noreply.github.com>

Report the type FilePath where a signature could say what the path is

HsNoFilePath. Everything it reports is a module's own signature naming the type
where path's Path would say whether it holds a file or a directory and whether
it is absolute or relative.

Read off the token stream rather than the parse tree, because that is where a
name the code wrote is already told apart from the same word elsewhere: a
comment saying "a FilePath is a String", the string literal of the same
sentence, and the tail of `import System.FilePath` are each their own token.
good.hs holds all three and its golden is empty.

Each finding is scoped to the declaration it is inside, so the suppression the
report offers goes above that declaration and nowhere wider. Converting at the
edge is not reported at all: readFile (toFilePath file) is correct and stays
quiet.

The fact it reads is new. Nothing recorded which capitalised names a module
writes, so NameFact arrives with it, along with the conid pass in Parse and the
declaration lookup in Extract that says where an annotation about one would
have to go.

The repository already passes, because the commit below this one converted it.
Nothing here changes existing code beyond the one line that registers the rule.

Not here: the same rule over `import System.FilePath` and `import
System.Directory`. An import is not a declaration, so the attachment pass has
nowhere to put a suppression above one, and a file-scoped suppression would
exempt every other finding in the file. A rule whose findings cannot be
suppressed where they are is the one thing suppressions must not be.