MCPcopy Create free account
hub / github.com/PaddlePaddle/Serving / with_returns

Method with_returns

tools/codestyle/docstring_checker.py:285–311  ·  view source on GitHub ↗

with_returns checks if docstring comments what are returned . Args: node (astroid.node): the node is visiting. doc (Docstring): Docstring object. Returns: True if successful otherwise False.

(self, node, doc)

Source from the content-addressed store, hash-verified

283 return True
284
285 def with_returns(self, node, doc):
286 """with_returns checks if docstring comments what are returned .
287 Args:
288 node (astroid.node): the node is visiting.
289 doc (Docstring): Docstring object.
290 Returns:
291 True if successful otherwise False.
292 """
293
294 if node.name.startswith("__") or node.name.startswith("_"):
295 return True
296 find = False
297 for t in node.body:
298 if not isinstance(t, astroid.Return):
299 continue
300
301 find = True
302 break
303
304 if not find:
305 return True
306
307 if len(doc.get_returns()) == 0:
308 self.add_message('W9007', node=node, line=node.fromlineno)
309 return False
310
311 return True
312
313 def all_args_in_doc(self, node, doc):
314 """all_args_in_doc checks if arguments are mentioned in doc

Callers 1

visit_functiondefMethod · 0.95

Calls 1

get_returnsMethod · 0.80

Tested by

no test coverage detected