Skip to content

Commit

Permalink
[logging-too-many-args] Change confidence to HIGH
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Jun 3, 2024
1 parent e938c17 commit 86e1943
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion pylint/checkers/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pylint import checkers
from pylint.checkers import utils
from pylint.checkers.utils import infer_all
from pylint.interfaces import HIGH
from pylint.typing import MessageDefinitionTuple

if TYPE_CHECKING:
Expand Down Expand Up @@ -369,7 +370,7 @@ def _check_format_string(self, node: nodes.Call, format_arg: Literal[0, 1]) -> N
self.add_message("logging-format-truncated", node=node)
return
if num_args > required_num_args:
self.add_message("logging-too-many-args", node=node)
self.add_message("logging-too-many-args", node=node, confidence=HIGH)
elif num_args < required_num_args:
self.add_message("logging-too-few-args", node=node)

Expand Down
22 changes: 11 additions & 11 deletions tests/functional/l/logging/logging_too_many_args_new_style.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
logging-too-many-args:5:0:5:38::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:6:0:6:25::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:7:0:7:26::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:8:0:8:48::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:9:0:9:49::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:13:0:13:38::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:14:0:14:25::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:15:0:15:25::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:16:0:16:48::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:17:0:17:48::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:20:0:20:50::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:5:0:5:38::Too many arguments for logging format string:HIGH
logging-too-many-args:6:0:6:25::Too many arguments for logging format string:HIGH
logging-too-many-args:7:0:7:26::Too many arguments for logging format string:HIGH
logging-too-many-args:8:0:8:48::Too many arguments for logging format string:HIGH
logging-too-many-args:9:0:9:49::Too many arguments for logging format string:HIGH
logging-too-many-args:13:0:13:38::Too many arguments for logging format string:HIGH
logging-too-many-args:14:0:14:25::Too many arguments for logging format string:HIGH
logging-too-many-args:15:0:15:25::Too many arguments for logging format string:HIGH
logging-too-many-args:16:0:16:48::Too many arguments for logging format string:HIGH
logging-too-many-args:17:0:17:48::Too many arguments for logging format string:HIGH
logging-too-many-args:20:0:20:50::Too many arguments for logging format string:HIGH
22 changes: 11 additions & 11 deletions tests/functional/l/logging/logging_too_many_args_old_style.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
logging-too-many-args:5:0:5:38::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:6:0:6:25::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:7:0:7:26::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:8:0:8:48::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:9:0:9:49::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:12:0:12:54::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:14:0:14:38::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:15:0:15:25::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:16:0:16:25::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:17:0:17:48::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:18:0:18:48::Too many arguments for logging format string:UNDEFINED
logging-too-many-args:5:0:5:38::Too many arguments for logging format string:HIGH
logging-too-many-args:6:0:6:25::Too many arguments for logging format string:HIGH
logging-too-many-args:7:0:7:26::Too many arguments for logging format string:HIGH
logging-too-many-args:8:0:8:48::Too many arguments for logging format string:HIGH
logging-too-many-args:9:0:9:49::Too many arguments for logging format string:HIGH
logging-too-many-args:12:0:12:54::Too many arguments for logging format string:HIGH
logging-too-many-args:14:0:14:38::Too many arguments for logging format string:HIGH
logging-too-many-args:15:0:15:25::Too many arguments for logging format string:HIGH
logging-too-many-args:16:0:16:25::Too many arguments for logging format string:HIGH
logging-too-many-args:17:0:17:48::Too many arguments for logging format string:HIGH
logging-too-many-args:18:0:18:48::Too many arguments for logging format string:HIGH
Empty file.
2 changes: 1 addition & 1 deletion tests/functional/s/string/string_formatting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ too-few-format-args:96:4:96:25:pprint_bad:Not enough arguments for format string
too-few-format-args:97:4:97:26:pprint_bad:Not enough arguments for format string:UNDEFINED
too-many-format-args:98:4:98:32:pprint_bad:Too many arguments for format string:UNDEFINED
logging-too-few-args:99:4:99:30:pprint_bad:Not enough arguments for logging format string:UNDEFINED
logging-too-many-args:100:4:100:31:pprint_bad:Too many arguments for logging format string:UNDEFINED
logging-too-many-args:100:4:100:31:pprint_bad:Too many arguments for logging format string:HIGH
format-string-without-interpolation:101:4:101:22:pprint_bad:Using formatting for a string that does not have any interpolated variables:UNDEFINED
format-string-without-interpolation:102:4:102:23:pprint_bad:Using formatting for a string that does not have any interpolated variables:UNDEFINED
format-string-without-interpolation:103:4:103:23:pprint_bad:Using formatting for a string that does not have any interpolated variables:UNDEFINED
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/s/string/string_log_formatting.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
logging-too-many-args:14:4:14:23:pprint:Too many arguments for logging format string:UNDEFINED
logging-too-many-args:15:4:15:24:pprint:Too many arguments for logging format string:UNDEFINED
logging-too-many-args:14:4:14:23:pprint:Too many arguments for logging format string:HIGH
logging-too-many-args:15:4:15:24:pprint:Too many arguments for logging format string:HIGH
logging-format-truncated:16:4:16:27:pprint:Logging format string ends in middle of conversion specifier:UNDEFINED
logging-too-few-args:17:4:17:28:pprint:Not enough arguments for logging format string:UNDEFINED
logging-unsupported-format:18:4:18:32:pprint:Unsupported logging format character 'y' (0x79) at index 3:UNDEFINED
logging-too-many-args:19:4:19:36:pprint:Too many arguments for logging format string:UNDEFINED
logging-too-many-args:19:4:19:36:pprint:Too many arguments for logging format string:HIGH

0 comments on commit 86e1943

Please sign in to comment.