Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
yml 54 lines 1.25 KB
Raw
1 id: py-empty-except
2 language: Python
3 severity: error
4 message: Handle or propagate the exception; a broad except with only pass discards every failure.
5 files: ['python/**', 'scripts/**', '.github/scripts/**']
6 ignores:
7 - '**/node_modules/**'
8 - '**/.venv/**'
9 - '**/.nox/**'
10 - '**/build/**'
11 - '**/dist/**'
12 - '**/test/**'
13 - '**/tests/**'
14 - '**/integration_test/**'
15 - '**/test_*.py'
16 - '**/*_test.py'
17 rule:
18 kind: except_clause
19 any:
20 - regex: '^except\s*:'
21 - has:
22 field: value
23 any:
24 - matches: broad-exception-type
25 - kind: as_pattern
26 has:
27 matches: broad-exception-type
28 has:
29 kind: block
30 has:
31 kind: pass_statement
32 not:
33 has:
34 not:
35 any:
36 - kind: pass_statement
37 - kind: comment
38 utils:
39 broad-exception-name:
40 kind: identifier
41 regex: '^(Exception|BaseException)$'
42 broad-exception-type:
43 any:
44 - matches: broad-exception-name
45 - kind: parenthesized_expression
46 has:
47 matches: broad-exception-name
48 - kind: tuple
49 has:
50 any:
51 - matches: broad-exception-name
52 - kind: parenthesized_expression
53 has:
54 matches: broad-exception-name