ruff/docs
Sigurd Spieckermann 518b29a9ef
Add `RUFF_OUTPUT_FILE` environment variable support (#10992)
## Summary

I've added support for configuring the `ruff check` output file via the
environment variable `RUFF_OUTPUT_FILE` akin to #1731.

This is super useful when, e.g., generating a [GitLab code quality
report](https://docs.gitlab.com/ee/ci/testing/code_quality.html#implement-a-custom-tool)
while running Ruff as a pre-commit hook. Usually, `ruff check` should
print its human-readable output to `stdout`, but when run through
`pre-commit` _in a GitLab CI job_ it should write its output in `gitlab`
format to a file. So, to override these two settings only during CI,
environment variables come handy, and `RUFF_OUTPUT_FORMAT` already
exists but `RUFF_OUTPUT_FILE` has been missing.

A (simplified) GitLab CI job config for this scenario might look like
this:

```yaml
pre-commit:
  stage: test
  image: python
  variables:
    RUFF_OUTPUT_FILE: gl-code-quality-report.json
    RUFF_OUTPUT_FORMAT: gitlab
  before_script:
    - pip install pre-commit
  script:
    - pre-commit run --all-files --show-diff-on-failure
  artifacts:
    reports:
      codequality: gl-code-quality-report.json
```

## Test Plan

I tested it manually.
2024-04-17 11:42:45 -04:00
..
.overrides/partials/integrations/analytics Move some MkDocs responsibilities around (#5542) 2023-07-05 22:06:01 +00:00
assets Update docs to match updated logo and color palette (#5283) 2023-06-22 11:19:34 -04:00
formatter Move deviations from formatter README to documentation (#10444) 2024-03-18 08:22:28 +00:00
stylesheets fix(docs): admonition in dark mode (#9502) 2024-01-13 07:43:13 -05:00
.gitignore Fix gitignore to not ignore files that are required (#7538) 2023-09-21 21:33:09 +02:00
configuration.md Add `RUFF_OUTPUT_FILE` environment variable support (#10992) 2024-04-17 11:42:45 -04:00
faq.md Support FORCE_COLOR env var (#10839) 2024-04-08 15:29:29 -06:00
formatter.md docs: `Lint` -> `Format` in formatter.md (#10777) 2024-04-04 16:50:55 +00:00
installation.md `docs`: remove `.` from check and format commands (#10217) 2024-03-13 10:10:48 -05:00
integrations.md Bump version to v0.3.7 (#10895) 2024-04-12 03:39:45 +00:00
linter.md `docs`: remove `.` from check and format commands (#10217) 2024-03-13 10:10:48 -05:00
preview.md Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00
requirements-insiders.txt Add a formatting step using `mdformat` as part of `generate_mkdocs.py` (#10484) 2024-03-21 00:37:40 +00:00
requirements.txt Add a formatting step using `mdformat` as part of `generate_mkdocs.py` (#10484) 2024-03-21 00:37:40 +00:00
tutorial.md Update number of implemented rules to "over 800" (#10500) 2024-03-20 22:39:37 -04:00
versioning.md Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00