ruff/crates
David Peter 000948ad3b
[red-knot] Statically known branches (#15019)
## Summary

This changeset adds support for precise type-inference and
boundness-handling of definitions inside control-flow branches with
statically-known conditions, i.e. test-expressions whose truthiness we
can unambiguously infer as *always false* or *always true*.

This branch also includes:
- `sys.platform` support
- statically-known branches handling for Boolean expressions and while
  loops
- new `target-version` requirements in some Markdown tests which were
  now required due to the understanding of `sys.version_info` branches.

closes #12700 
closes #15034 

## Performance

### `tomllib`, -7%, needs to resolve one additional module (sys)

| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `./red_knot_main --project /home/shark/tomllib` | 22.2 ± 1.3 | 19.1 |
25.6 | 1.00 |
| `./red_knot_feature --project /home/shark/tomllib` | 23.8 ± 1.6 | 20.8
| 28.6 | 1.07 ± 0.09 |

### `black`, -6%

| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `./red_knot_main --project /home/shark/black` | 129.3 ± 5.1 | 119.0 |
137.8 | 1.00 |
| `./red_knot_feature --project /home/shark/black` | 136.5 ± 6.8 | 123.8
| 147.5 | 1.06 ± 0.07 |

## Test Plan

- New Markdown tests for the main feature in
  `statically-known-branches.md`
- New Markdown tests for `sys.platform`
- Adapted tests for `EllipsisType`, `Never`, etc
2024-12-21 11:33:10 +01:00
..
red_knot Upgrade salsa (#15039) 2024-12-17 15:50:33 +00:00
red_knot_python_semantic [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
red_knot_server Upgrade salsa (#15039) 2024-12-17 15:50:33 +00:00
red_knot_test [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
red_knot_vendored Sync vendored typeshed stubs (#14977) 2024-12-15 01:02:41 +00:00
red_knot_wasm Rename `custom-typeshed-dir`, `target-version` and `current-directory` CLI options (#14930) 2024-12-13 08:21:52 +00:00
red_knot_workspace [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
ruff [`ruff`] Adds an allowlist for `unsafe-markup-use` (`RUF035`) (#15076) 2024-12-20 09:36:12 +00:00
ruff_benchmark [red-knot] Avoid undeclared path when raising conflicting declarations (#14958) 2024-12-17 09:49:39 +05:30
ruff_cache Fix cache key collisions for paths with separators (#12159) 2024-07-03 07:36:46 -05:00
ruff_db Upgrade salsa (#15039) 2024-12-17 15:50:33 +00:00
ruff_dev Alternate quotes for strings inside f-strings in preview (#13860) 2024-10-23 07:57:53 +02:00
ruff_diagnostics Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
ruff_formatter More typos found by codespell (#14880) 2024-12-09 22:47:34 +00:00
ruff_graph [red-knot] Statically known branches (#15019) 2024-12-21 11:33:10 +01:00
ruff_index [red-knot] small efficiency improvements and bugfixes to use-def map building (#12373) 2024-07-18 09:24:58 -07:00
ruff_linter [`pydocstyle`] Split on first whitespace character (`D403`) (#15082) 2024-12-20 12:55:50 -06:00
ruff_macros [red-knot] Add infrastructure to declare lints (#14873) 2024-12-10 16:14:44 +00:00
ruff_notebook Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
ruff_python_ast [ruff_python_ast] Add name and default functions to TypeParam. (#14964) 2024-12-15 12:04:51 +00:00
ruff_python_ast_integration_tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_python_codegen ruff_python_ast: Make `Singleton` `Copy` (#14943) 2024-12-12 20:49:54 +01:00
ruff_python_formatter Add tests demonstrating f-strings with debug expressions in replacements that contain escaped characters (#14929) 2024-12-12 09:33:20 +00:00
ruff_python_index Extract `LineIndex` independent methods from `Locator` (#13938) 2024-10-28 07:53:41 +00:00
ruff_python_literal Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
ruff_python_parser Modify parsing of raise with cause when exception is absent (#15049) 2024-12-19 13:36:32 +00:00
ruff_python_resolver Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_python_semantic [`ruff`] Avoid false positives for RUF027 for typing context bindings. (#15037) 2024-12-18 08:50:49 +01:00
ruff_python_stdlib [`ruff`] Implemented `used-dummy-variable` (`RUF052`) (#14611) 2024-12-03 08:36:16 +01:00
ruff_python_trivia [`pylint`] Preserve original value format (`PLR6104`) (#14978) 2024-12-17 16:07:07 +01:00
ruff_python_trivia_integration_tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_server Check diagnostic refresh support from client capability (#15014) 2024-12-16 16:26:40 +05:30
ruff_source_file [`pyupgrade`] Do not report when a UTF-8 comment is followed by a non-UTF-8 one (`UP009`) (#14728) 2024-12-11 10:30:41 +00:00
ruff_text_size Extract `LineIndex` independent methods from `Locator` (#13938) 2024-10-28 07:53:41 +00:00
ruff_wasm Bump version to 0.8.4 (#15064) 2024-12-19 13:15:42 +00:00
ruff_workspace [`ruff`] Adds an allowlist for `unsafe-markup-use` (`RUF035`) (#15076) 2024-12-20 09:36:12 +00:00