ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Add --log-format and --log-path

Open JonathanPlasse opened this issue 3 years ago • 3 comments

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.

JonathanPlasse avatar Dec 02 '22 12:12 JonathanPlasse

Can we find an example of a tool or two that does this well, and mirror their API?

charliermarsh avatar Dec 02 '22 14:12 charliermarsh

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.

JonathanPlasse avatar Dec 02 '22 15:12 JonathanPlasse

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.

JonathanPlasse avatar Dec 03 '22 19:12 JonathanPlasse

We now support outputting to a file.

charliermarsh avatar Jun 20 '23 16:06 charliermarsh