forked from sourcery-ai/sourcery-rules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_debugging_statements.yaml
47 lines (43 loc) · 1.12 KB
/
remove_debugging_statements.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# These optional rules flag or remove various debugging statements.
#
# All rules in this file have the tag `no-debug`.
#
rules:
- id: remove-breakpoint
description: Remove breakpoints from production code
explanation: Breakpoints shouldn't be used in production code.
pattern: breakpoint(...)
replacement: ''
tests:
- match: breakpoint()
- match: breakpoint("sth")
tags:
- no-debug
- id: remove-pdb-set_trace
description: Remove `pdb.set_trace` calls from production code
explanation: Breakpoints shouldn't be used in production code.
pattern: pdb.set_trace(...)
replacement: ''
tests:
- match: |
import pdb
pdb.set_trace()
- match: |
import pdb as pdb_debug
pdb_debug.set_trace()
tags:
- no-debug
- id: flag-print
description: Remove `print` statements from production code
explanation: |
`print` statements shouldn't be used in production code.
Use:
* a CLI framework for output
* `logger.debug()` for debugging information.
pattern: print(...)
tests:
- match: print("sth")
- match: print(x, y)
- no-match: custom_print("sth")
tags:
- no-debug