Path 1: 2455 calls (0.47)

'function' (862) 'module' (686) 'class' (570) 'method' (337)

FunctionDef (1190) Module (686) ClassDef (570) AsyncFunctionDef (9)

True (2424) False (31)

Confidence (2455)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 2: 1062 calls (0.2)

'function' (635) 'method' (427)

FunctionDef (1036) AsyncFunctionDef (26)

True (1062)

Confidence (1062)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 3: 924 calls (0.18)

'class' (924)

ClassDef (924)

True (924)

Confidence (924)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 4: 288 calls (0.06)

'module' (288)

Module (288)

True (288)

Confidence (288)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 5: 125 calls (0.02)

'module' (125)

Module (125)

True (125)

Confidence (125)

None (125)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 6: 105 calls (0.02)

'function' (63) 'method' (42)

FunctionDef (103) AsyncFunctionDef (2)

True (105)

Confidence (105)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 7: 103 calls (0.02)

'method' (103)

FunctionDef (100) AsyncFunctionDef (3)

False (103)

Confidence (103)

None (103)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 8: 82 calls (0.02)

'function' (56) 'method' (26)

FunctionDef (74) AsyncFunctionDef (8)

True (82)

Confidence (82)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 9: 17 calls (0.0)

'class' (17)

ClassDef (17)

True (17)

Confidence (17)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 10: 10 calls (0.0)

'method' (9) 'function' (1)

FunctionDef (10)

True (10)

Confidence (10)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 11: 6 calls (0.0)

'function' (3) 'method' (2) 'module' (1)

FunctionDef (4) AsyncFunctionDef (1) Module (1)

True (5) False (1)

Confidence (6)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 12: 5 calls (0.0)

'module' (5)

Module (5)

True (5)

Confidence (5)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 13: 4 calls (0.0)

'module' (4)

Module (4)

True (4)

Confidence (4)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 14: 2 calls (0.0)

'function' (2)

FunctionDef (2)

True (2)

Confidence (2)

None (2)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 15: 2 calls (0.0)

'method' (2)

FunctionDef (2)

True (2)

Confidence (2)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 16: 1 calls (0.0)

'class' (1)

ClassDef (1)

True (1)

Confidence (1)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )
            

Path 17: 1 calls (0.0)

'function' (1)

FunctionDef (1)

True (1)

Confidence (1)

None (1)

1def _check_docstring(
2        self,
3        node_type: Literal["class", "function", "method", "module"],
4        node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
5        report_missing: bool = True,
6        confidence: interfaces.Confidence = interfaces.HIGH,
7    ) -> None:
8        """Check if the node has a non-empty docstring."""
9        docstring = node.doc_node.value if node.doc_node else None
10        if docstring is None:
11            docstring = _infer_dunder_doc_attribute(node)
12
13        if docstring is None:
14            if not report_missing:
15                return
16            lines = utils.get_node_last_lineno(node) - node.lineno
17
18            if node_type == "module" and not lines:
19                # If the module does not have a body, there's no reason
20                # to require a docstring.
21                return
22            max_lines = self.linter.config.docstring_min_length
23
24            if node_type != "module" and max_lines > -1 and lines < max_lines:
25                return
26            if node_type == "class":
27                self.linter.stats.undocumented["klass"] += 1
28            else:
29                self.linter.stats.undocumented[node_type] += 1
30            if (
31                node.body
32                and isinstance(node.body[0], nodes.Expr)
33                and isinstance(node.body[0].value, nodes.Call)
34            ):
35                # Most likely a string with a format call. Let's see.
36                func = utils.safe_infer(node.body[0].value.func)
37                if isinstance(func, astroid.BoundMethod) and isinstance(
38                    func.bound, astroid.Instance
39                ):
40                    # Strings.
41                    if func.bound.name in {"str", "unicode", "bytes"}:
42                        return
43            if node_type == "module":
44                message = "missing-module-docstring"
45            elif node_type == "class":
46                message = "missing-class-docstring"
47            else:
48                message = "missing-function-docstring"
49            self.add_message(message, node=node, confidence=confidence)
50        elif not docstring.strip():
51            if node_type == "class":
52                self.linter.stats.undocumented["klass"] += 1
53            else:
54                self.linter.stats.undocumented[node_type] += 1
55            self.add_message(
56                "empty-docstring", node=node, args=(node_type,), confidence=confidence
57            )