Add --log-format and --log-path
I use Ruff hook in pre-commit.
In CI, I want to run pre-commit run --all-files and I would like that it generate a log in Junit format in addition to the nice output in stdout.
If --log-format and --log-path are unspecified, no log would be generated.
If only --log-path is specified, default to the default format.
If only --log-format is specified, default to write a log to the root with a default name (what should the default name be?)
I could submit a pull request if it is ok.
Can we find an example of a tool or two that does this well, and mirror their API?
mypy has junit_xml = "reports/mypy.xml" in pyproject.toml.
pytest has --junitxml=reports/pytest.xml" in the CLI.
I would propose --junit-xml in the CLI and junit-xml in pyproject.toml.
Only the Junit format interest me.
I found an alternative; I skip Ruff in pre-commit with:
SKIP=ruff pre-commit run --all-files
then run
ruff --format=junit > reports/ruff.xml
But I still think it could be a useful feature.
We now support outputting to a file.