ruff/crates/ruff_python_semantic/src/analyze
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
..
class.rs Add base-class inheritance detection to flake8-django rules (#9151) 2023-12-15 18:01:32 +00:00
function_type.rs Support local and dynamic class- and static-method decorators (#8592) 2023-11-10 02:04:25 +00:00
imports.rs Allow matplotlib.use calls to intersperse imports (#9094) 2023-12-11 17:06:25 +00:00
logging.rs Allow capitalized names for logger candidate heuristic match (#6356) 2023-08-04 23:25:34 +00:00
mod.rs Respect mixed return and raise cases in return-type analysis (#9310) 2023-12-29 16:46:37 +00:00
terminal.rs Respect mixed return and raise cases in return-type analysis (#9310) 2023-12-29 16:46:37 +00:00
type_inference.rs New AST nodes for f-string elements (#8835) 2023-12-07 10:28:05 -06:00
typing.rs Respect attribute chains when resolving builtin call paths (#9309) 2023-12-29 15:13:24 +00:00
visibility.rs [pylint] Implement too-many-public-methods rule (PLR0904) (#6179) 2023-09-14 00:52:26 +00:00