How would I signal that a linter failed to lint? (...
# development
c
How would I signal that a linter failed to lint? (Or, more generally, that any goal failed?) Is there something more elegant that just raising a ValueError and letting the engine handle it?
h
The two options are either to fail gracefully by returning a
LintResult
with a failed code, or to fail ungracefully via an exception that brings down all of Pants What's the failure look like? Is it an expected error for example?
c
thinking of https://github.com/pantsbuild/pants/issues/18618 . If the config file can't be loaded, we're going to do the wrong thing. I think it makes more sense to return with a failed code. Next problem is that Isort is actually a formatter, and FmtResult/FixResult doesn't have an exit_code field...
docformatter raises a ProcessExecutionFailure. That makes more sense there since the process has a real exit code. Here isort completes successfully
h
Yeah, at least for the fmt rule, we would need to raise an exception
Thanks for looking into that issue btw!