A public function has no return annotation

tx0/python:missing-return-annotationstrictnotestyle

What it finds

Without a return annotation, type checkers infer the result or treat it as unknown, and callers have to read the body to learn what comes back. Checked are public functions and methods, as undocumented-function defines them; __init__ and other special methods, overloads, setters and functions marked @override are not, and neither are stubs and test files.

From the rule's source, missing_return_annotation.rs.

Example from the rule's tests
def load(path):tx0 reports: this public function does not say what it returns    return path  def save(path) -> None:    pass  def _helper():    pass  class Store:    def __init__(self):        pass     def get(self, key):tx0 reports: this public function does not say what it returns        return key
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:missing-return-annotation" = "note"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:missing-return-annotation] reason="..."

tx0 explain tx0/python:missing-return-annotation shows the same in the terminal. Found a false positive? Report it.