516a157a

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

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.

Suite timing

Time to Start Worker time Duration Time to finish Idle
Config 53s 2s 2s 56s 53s
Eval 59s 11s 11s 1m10s 3s
Build 1m10s 0s 1m26s 2m37s 1m26s
Suite 53s 14s 1m44s 2m37s 2m23s

Timeline

0s1m1m10s