59 node = context.node |
59 node = context.node |
60 if len(node.body) == 1: |
60 if len(node.body) == 1: |
61 if ( |
61 if ( |
62 not checkTypedException |
62 not checkTypedException |
63 and node.type is not None |
63 and node.type is not None |
64 and getattr(node.type, "id", None) != "Exception" |
64 and getattr(node.type, "id", None) not in ("BaseException", "Exception") |
65 ): |
65 ): |
66 return |
66 return |
67 |
67 |
68 if isinstance(node.body[0], ast.Pass): |
68 if isinstance(node.body[0], ast.Pass): |
69 reportError( |
69 reportError( |
95 node = context.node |
95 node = context.node |
96 if len(node.body) == 1: |
96 if len(node.body) == 1: |
97 if ( |
97 if ( |
98 not checkTypedException |
98 not checkTypedException |
99 and node.type is not None |
99 and node.type is not None |
100 and getattr(node.type, "id", None) != "Exception" |
100 and getattr(node.type, "id", None) not in ("BaseException", "Exception") |
101 ): |
101 ): |
102 return |
102 return |
103 |
103 |
104 if isinstance(node.body[0], ast.Continue): |
104 if isinstance(node.body[0], ast.Continue): |
105 reportError( |
105 reportError( |
134 return |
134 return |
135 |
135 |
136 qualnameList = qualname.split(".") |
136 qualnameList = qualname.split(".") |
137 func = qualnameList[-1] |
137 func = qualnameList[-1] |
138 if func == "suppress": |
138 if func == "suppress": |
139 if not checkTypedException and "Exception" not in context.callArgs: |
139 if ( |
|
140 not checkTypedException |
|
141 and "Exception" not in context.callArgs |
|
142 and "BaseException" not in context.callArgs |
|
143 ): |
140 return |
144 return |
141 |
145 |
142 reportError( |
146 reportError( |
143 context.node.lineno - 1, |
147 context.node.lineno - 1, |
144 context.node.col_offset, |
148 context.node.col_offset, |