(self, node: ast.FunctionDef | ast.AsyncFunctionDef)
| 906 | self.generic_visit(node) |
| 907 | |
| 908 | def _check_S021(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: |
| 909 | annot = _extract_response_annotation_Ts(node.returns) |
| 910 | if annot is None: |
| 911 | return |
| 912 | declared: list[ast.expr] = [] |
| 913 | for dec in node.decorator_list: |
| 914 | declared.extend(_decorator_response_Ts(dec)) |
| 915 | if not declared: |
| 916 | return |
| 917 | decl_set = {_name_of(t) for t in declared} |
| 918 | annot_set = {_name_of(t) for t in annot} |
| 919 | missing = decl_set - annot_set |
| 920 | if missing: |
| 921 | self.errors.append( |
| 922 | (node.lineno, node.col_offset, S021_msg.format(", ".join(sorted(missing)))) |
| 923 | ) |
| 924 | |
| 925 | def _check_S022(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> None: |
| 926 | if not self._publish_status or node.name not in HTTP_METHODS: |
no test coverage detected