Method: pylint.extensions.docparams.DocstringParameterChecker.visit_yield
Calls: 34, Exceptions: 0, Paths: 10Back
Path 1: 11 calls (0.32)
Yield (11)
None (11)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 2: 6 calls (0.18)
Yield (6)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 3: 4 calls (0.12)
Yield (4)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 4: 3 calls (0.09)
Yield (3)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 5: 3 calls (0.09)
Yield (3)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 6: 2 calls (0.06)
Yield (2)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 7: 2 calls (0.06)
Yield (2)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 8: 1 calls (0.03)
Yield (1)
None (1)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 9: 1 calls (0.03)
Yield (1)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)
Path 10: 1 calls (0.03)
Yield (1)
1def visit_yield(self, node: nodes.Yield | nodes.YieldFrom) -> None:
2 if self.linter.config.accept_no_yields_doc:
3 return
4
5 func_node: astroid.FunctionDef = node.frame(future=True)
6
7 # skip functions that match the 'no-docstring-rgx' config option
8 no_docstring_rgx = self.linter.config.no_docstring_rgx
9 if no_docstring_rgx and re.match(no_docstring_rgx, func_node.name):
10 return
11
12 doc = utils.docstringify(
13 func_node.doc_node, self.linter.config.default_docstring_type
14 )
15
16 if doc.supports_yields:
17 doc_has_yields = doc.has_yields()
18 doc_has_yields_type = doc.has_yields_type()
19 else:
20 doc_has_yields = doc.has_returns()
21 doc_has_yields_type = doc.has_rtype()
22
23 if not doc_has_yields:
24 self.add_message("missing-yield-doc", node=func_node, confidence=HIGH)
25
26 if not (doc_has_yields_type or func_node.returns):
27 self.add_message("missing-yield-type-doc", node=func_node, confidence=HIGH)