ruff
db97c8fa - [ty] Make error-on-warning the default (#26157)

Commit
146 days ago
[ty] Make error-on-warning the default (#26157) ## Summary - Make warning diagnostics produce exit code 1 by default. - Add `--exit-zero-on-warning` as an explicit command-line opt-out while preserving the existing `--error-on-warning` override. - Keep `terminal.error-on-warning` configurable and regenerate ty's CLI reference, configuration documentation, schema, and affected snapshots. You generally want warnings to lead to an exit code of 1 if you're invoking ty in CI, or from a runner like pre-commit/prek. (pre-commit/prek actually suppress all stdout/stderr output if a hook exits with code 0.) We could try to detect environment variables like `CI=1` or `PRE_COMMIT=1`, but that feels fragile, and it's also surprising/annoying if ty "magically" behaves differently in CI than it does locally. Humans generally don't care much about the exit code locally, so we don't expect this to have a significant impact for local usage outside of pre-commit/prek. This PR therefore changes the global default to exiting with code 1, even if all diagnostics have `warning` severity. This remains configurable by setting `tool.ty.terminal.error-on-warning = false` in a `pyproject.toml` file. On the command line, `--exit-zero-on-warning` provides the inverse opt-out, while the existing `--error-on-warning` flag remains available as an explicit override.
Author
Parents
Loading