MCPcopy Create free account
hub / github.com/getsentry/sentry / _check_S021

Method _check_S021

tools/flake8_plugin.py:908–923  ·  view source on GitHub ↗
(self, node: ast.FunctionDef | ast.AsyncFunctionDef)

Source from the content-addressed store, hash-verified

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:

Callers 2

visit_FunctionDefMethod · 0.95

Calls 6

_decorator_response_TsFunction · 0.85
_name_ofFunction · 0.85
appendMethod · 0.65
extendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected