Path 1: 19 calls (0.4)

Raise (19)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)
            

Path 2: 19 calls (0.4)

Raise (19)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)
            

Path 3: 5 calls (0.1)

Raise (5)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)
            

Path 4: 2 calls (0.04)

Raise (2)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)
            

Path 5: 1 calls (0.02)

Raise (1)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)
            

Path 6: 1 calls (0.02)

Raise (1)

None (1)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)
            

Path 7: 1 calls (0.02)

Raise (1)

1def _check_misplaced_bare_raise(self, node: nodes.Raise) -> None:
2        # Filter out if it's present in __exit__.
3        scope = node.scope()
4        if (
5            isinstance(scope, nodes.FunctionDef)
6            and scope.is_method()
7            and scope.name == "__exit__"
8        ):
9            return
10
11        current = node
12        # Stop when a new scope is generated or when the raise
13        # statement is found inside a TryFinally.
14        ignores = (nodes.ExceptHandler, nodes.FunctionDef)
15        while current and not isinstance(current.parent, ignores):
16            current = current.parent
17
18        expected = (nodes.ExceptHandler,)
19        if not current or not isinstance(current.parent, expected):
20            self.add_message("misplaced-bare-raise", node=node, confidence=HIGH)