-
Notifications
You must be signed in to change notification settings - Fork 900
/
logging_too_many_args.py
46 lines (26 loc) · 1.27 KB
/
logging_too_many_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
import logging
logging.warning("Hello %s", "World!", "again") # [logging-too-many-args]
logging.warning("Hello %s", "World!", "again", something="else")
logging.warning("Hello %s", "World!")
# 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", {"objects": 1, "modifications": 1, "errors": 1})
logging.info(msg="Hello")
logging.info(msg="Hello", something="else")
import warning
warning.warning("Hello %s", "World!", "again")
from logging import info, error, warning
warning("Hello %s", "World!", "again") # [logging-too-many-args]
warning("Hello %s", "World!", "again", something="else")
warning("Hello %s", "World!")
# 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", {"objects": 1, "modifications": 1, "errors": 1})
info(msg="Hello")
info(msg="Hello", something="else")