Method: pylint.checkers.base.docstring_checker.DocStringChecker.visit_functiondef
Calls: 3508, Exceptions: 0, Paths: 15Back
Path 1: 1623 calls (0.46)
FunctionDef (1588) AsyncFunctionDef (35)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 2: 779 calls (0.22)
FunctionDef (776) AsyncFunctionDef (3)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 3: 684 calls (0.19)
FunctionDef (673) AsyncFunctionDef (11)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 4: 132 calls (0.04)
FunctionDef (129) AsyncFunctionDef (3)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 5: 112 calls (0.03)
FunctionDef (110) AsyncFunctionDef (2)
None (112)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 6: 110 calls (0.03)
FunctionDef (110)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 7: 24 calls (0.01)
FunctionDef (24)
None (24)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 8: 20 calls (0.01)
FunctionDef (20)
None (20)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 9: 8 calls (0.0)
FunctionDef (8)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 10: 6 calls (0.0)
FunctionDef (6)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 11: 3 calls (0.0)
FunctionDef (3)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 12: 2 calls (0.0)
FunctionDef (2)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 13: 2 calls (0.0)
FunctionDef (2)
None (2)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 14: 2 calls (0.0)
FunctionDef (2)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return
Path 15: 1 calls (0.0)
FunctionDef (1)
1@utils.only_required_for_messages("missing-function-docstring", "empty-docstring")
2 def visit_functiondef(self, node: nodes.FunctionDef) -> None:
3 if self.linter.config.no_docstring_rgx.match(node.name) is None:
4 ftype = "method" if node.is_method() else "function"
5 if (
6 is_property_setter(node)
7 or is_property_deleter(node)
8 or is_overload_stub(node)
9 ):
10 return
11
12 if isinstance(node.parent.frame(future=True), nodes.ClassDef):
13 overridden = False
14 confidence = (
15 interfaces.INFERENCE
16 if utils.has_known_bases(node.parent.frame(future=True))
17 else interfaces.INFERENCE_FAILURE
18 )
19 # check if node is from a method overridden by its ancestor
20 for ancestor in node.parent.frame(future=True).ancestors():
21 if ancestor.qname() == "builtins.object":
22 continue
23 if node.name in ancestor and isinstance(
24 ancestor[node.name], nodes.FunctionDef
25 ):
26 overridden = True
27 break
28 self._check_docstring(
29 ftype, node, report_missing=not overridden, confidence=confidence # type: ignore[arg-type]
30 )
31 elif isinstance(node.parent.frame(future=True), nodes.Module):
32 self._check_docstring(ftype, node) # type: ignore[arg-type]
33 else:
34 return