Pretty minimal linter that parses
hh_client --json check repo_root_here output and turns it into
lint warnings.
It's worth noting that the typical type error is an inconsistency
between two parts of the code, so we have some choice of where
to raise the actual lint warning. Here, we resolve this by:
- Raising every type error exactly once, at the first diff-relevant path that is mentioned in the Hack error...
- ...and using error-level severity for the lint warnings to ensure that they show up (even if the corresponding line was not modified in this diff).
Caveats
The framework (...ExternalLinter) really wants to
run the binary for each file. For hh_client that's not really
necessary [many type errors cross file boundaries, so the checker
doesn't have a specific file input], but we end up
doing it anyway. In practice, repeat calls to hh_client are cheap,
but we're still wasting time repeatedly parsing the same json.
Along the same lines as ^, we rely on the framework to filter
identical errors, or this would end up being very noisy.
- This includes some borderline-unrelated hacky changes in the test base class to make hh_client happy (needs .php files; needs a .hhconfig in the 'repo' root).