Skip to content

Commit ff4eb61

Browse files
committed
Allow customizing the module denylist
1 parent 6e513a2 commit ff4eb61

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pre_commit_hooks/debug_statement_hook.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,24 @@ def check_file(filename: str) -> int:
7474
def main(argv: Sequence[str] | None = None) -> int:
7575
parser = argparse.ArgumentParser()
7676
parser.add_argument('filenames', nargs='*', help='Filenames to run')
77+
parser.add_argument(
78+
'--forbid',
79+
type=str, action='append',
80+
help='Extra module name(s) to forbid'
81+
)
82+
parser.add_argument(
83+
'--allow',
84+
type=str,
85+
action='append',
86+
help='Extra module name(s) to allow'
87+
)
7788
args = parser.parse_args(argv)
7889

90+
for name in args.forbid or ():
91+
DEBUG_STATEMENTS.add(name)
92+
for name in args.allow or ():
93+
DEBUG_STATEMENTS.discard(name)
94+
7995
retv = 0
8096
for filename in args.filenames:
8197
retv |= check_file(filename)

0 commit comments

Comments
 (0)