-
Notifications
You must be signed in to change notification settings - Fork 903
/
logging_too_few_args.py
54 lines (32 loc) · 1.35 KB
/
logging_too_few_args.py
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
48
49
50
51
52
53
54
import logging
logging.warning("Hello %s %s", "World!") # [logging-too-few-args]
# do not handle calls with kwargs (like pylint)
logging.warning("Hello %s", "World!", "again", something="else")
logging.warning("Hello %s", "World!")
# do not handle calls without any args
logging.info("100% dynamic")
# do not handle calls with *args
logging.error("Example log %s, %s", "foo", "bar", "baz", *args)
# do not handle calls with **kwargs
logging.error("Example log %s, %s", "foo", "bar", "baz", **kwargs)
# do not handle keyword arguments
logging.error("%(objects)d modifications: %(modifications)d errors: %(errors)d")
logging.info(msg="Hello %s")
logging.info(msg="Hello %s %s")
import warning
warning.warning("Hello %s %s", "World!")
from logging import error, info, warning
warning("Hello %s %s", "World!") # [logging-too-few-args]
# do not handle calls with kwargs (like pylint)
warning("Hello %s", "World!", "again", something="else")
warning("Hello %s", "World!")
# do not handle calls without any args
info("100% dynamic")
# do not handle calls with *args
error("Example log %s, %s", "foo", "bar", "baz", *args)
# do not handle calls with **kwargs
error("Example log %s, %s", "foo", "bar", "baz", **kwargs)
# do not handle keyword arguments
error("%(objects)d modifications: %(modifications)d errors: %(errors)d")
info(msg="Hello %s")
info(msg="Hello %s %s")