ruff/crates/ruff_python_semantic/src/analyze
Charlie Marsh bf2cc3f520
Add autotyping-like return type inference for annotation rules (#8643)
## Summary

This PR adds (unsafe) fixes to the flake8-annotations rules that enforce
missing return types, offering to automatically insert type annotations
for functions with literal return values. The logic is smart enough to
generate simplified unions (e.g., `float` instead of `int | float`) and
deal with implicit returns (`return` without a value).

Closes https://github.com/astral-sh/ruff/issues/1640 (though we could
open a separate issue for referring parameter types).

Closes https://github.com/astral-sh/ruff/issues/8213.

## Test Plan

`cargo test`
2023-11-13 23:34:15 -05:00
..
function_type.rs Support local and dynamic class- and static-method decorators (#8592) 2023-11-10 02:04:25 +00:00
logging.rs Allow capitalized names for logger candidate heuristic match (#6356) 2023-08-04 23:25:34 +00:00
mod.rs Add branch detection to the semantic model (#6694) 2023-08-19 21:28:17 +00:00
type_inference.rs Add autotyping-like return type inference for annotation rules (#8643) 2023-11-13 23:34:15 -05:00
typing.rs Improve detection of `TYPE_CHECKING` blocks imported from `typing_extensions` or `_typeshed` (#8429) 2023-11-09 12:21:03 -06:00
visibility.rs [pylint] Implement `too-many-public-methods` rule (PLR0904) (#6179) 2023-09-14 00:52:26 +00:00