ruff/crates
Charlie Marsh 2895e7d126
Respect mixed return and raise cases in return-type analysis (#9310)
## Summary

Given:

```python
from somewhere import get_cfg

def lookup_cfg(cfg_description):
    cfg = get_cfg(cfg_description)
    if cfg is not None:
        return cfg
    raise AttributeError(f"No cfg found matching {cfg_description}")
```

We were analyzing the method from last-to-first statement. So we saw the
`raise`, then assumed the method _always_ raised. In reality, though, it
_might_ return. This PR improves the branch analysis to respect these
mixed cases.

Closes https://github.com/astral-sh/ruff/issues/9269.
Closes https://github.com/astral-sh/ruff/issues/9304.
2023-12-29 16:46:37 +00:00
..
flake8_to_ruff Bump pep440_rs from 0.3.12 to 0.4.0 (#9272) 2023-12-25 08:12:20 -05:00
ruff_benchmark Remove lexing and parsing from the linter benchmark (#9264) 2023-12-23 16:43:11 -05:00
ruff_cache Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_cli Remove lexing and parsing from the linter benchmark (#9264) 2023-12-23 16:43:11 -05:00
ruff_dev Escape trailing placeholders in rule documentation (#9301) 2023-12-28 09:44:51 -05:00
ruff_diagnostics Enable annotation quoting for multi-line expressions (#9142) 2023-12-15 01:03:09 +00:00
ruff_formatter remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
ruff_index Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_linter Respect mixed return and raise cases in return-type analysis (#9310) 2023-12-29 16:46:37 +00:00
ruff_macros remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
ruff_notebook Prevent invalid utf8 indexing in cell magic detection (#9146) 2023-12-15 08:15:46 -06:00
ruff_python_ast Respect mixed return and raise cases in return-type analysis (#9310) 2023-12-29 16:46:37 +00:00
ruff_python_codegen Add as_slice method for all string nodes (#9111) 2023-12-13 06:31:20 +00:00
ruff_python_formatter Normalise Hex and unicode escape sequences in string (#9280) 2023-12-28 09:06:58 +08:00
ruff_python_index Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_literal remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
ruff_python_parser Remove lexing and parsing from the linter benchmark (#9264) 2023-12-23 16:43:11 -05:00
ruff_python_resolver Bump env_logger from 0.10.0 to 0.10.1 (#9275) 2023-12-25 09:03:35 -05:00
ruff_python_semantic Respect mixed return and raise cases in return-type analysis (#9310) 2023-12-29 16:46:37 +00:00
ruff_python_stdlib Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_trivia [pylint] Implement empty-comment (PLR2044) (#9174) 2023-12-29 02:53:56 +00:00
ruff_shrinking Bump version to v0.1.9 (#9231) 2023-12-21 13:19:50 -05:00
ruff_source_file remove several uses of unsafe (#8600) 2023-11-28 09:50:03 -05:00
ruff_text_size Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_wasm Remove lexing and parsing from the linter benchmark (#9264) 2023-12-23 16:43:11 -05:00
ruff_workspace Bump pep440_rs from 0.3.12 to 0.4.0 (#9272) 2023-12-25 08:12:20 -05:00