Is there any way to have pants write the results o...
# general
l
Is there any way to have pants write the results of shellcheck and shfmt to a file rather than stdout? I don't think either of those tools have a native option for doing so, and parsing structure results out of the pants output seems a bit tricky.
h
Pants does have generic support for linters/formatters writing "reports", although currently only integrated with tools that have native support like Bandit and MyPy Are you thinking Pants could generate the report for you based on std{out,err}? Definitely feasible
l
yeah something like that
h
I don't think pantsbuild/pants wants to get in the business of maintaining a report generator for Shellcheck and Shfmt. But, I agree it's really useful and happy to help figure out how to get it working for you! I see two paths forward: 1) Upstream report generation to those tools 2) Create your own report generation logic and develop a Pants plugin that uses it. You'd basically be forking the specific rules for those two linter implementations (not Pants itself), and enriching with your reports. In your rule, you could do things like inspect
std{out,err}
, the changed files from shfmt, etc. And you can create any arbitrary report file(s) based on that
e
shfmt has -f to write to a file. shellcheck does not but does have a -f --format option where you could pick json and several other formats.
We should probably have an option to use stdout as a "report"; aka report redirection.
👍 1
We could just tee it.
l
@hundreds-father-404 I am not opposed to forking in principle, but generating reports seems like it would be a common need