summaryrefslogtreecommitdiff
path: root/pylint/utils/linterstats.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-10-29 10:15:30 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-11-03 10:16:38 +0100
commit6283c5aebf34c833c7f79c1e3c21cf3764dc1edd (patch)
treeab7e58080c2667695b0e1eee0e7531d9222483c9 /pylint/utils/linterstats.py
parent72f0f50ada9cafc586e1642259769d5bd9564bd5 (diff)
downloadpylint-git-invalid-toml-config.tar.gz
Add test for current pyproject issuesinvalid-toml-config
Diffstat (limited to 'pylint/utils/linterstats.py')
-rw-r--r--pylint/utils/linterstats.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/pylint/utils/linterstats.py b/pylint/utils/linterstats.py
index f46054455..212aa6dc0 100644
--- a/pylint/utils/linterstats.py
+++ b/pylint/utils/linterstats.py
@@ -285,9 +285,18 @@ class LinterStats:
increase: int,
) -> None:
"""Increase the message type count of an individual message type of a module"""
- self.by_module[modname][type_name] = (
- self.by_module[modname][type_name] + increase
- )
+ if self.by_module.get(modname, None) is None:
+ self.by_module[modname] = ModuleStats(
+ convention=0,
+ error=0,
+ fatal=0,
+ info=0,
+ refactor=0,
+ statement=0,
+ warning=0,
+ )
+ module_stat = self.by_module[modname][type_name]
+ self.by_module[modname][type_name] = module_stat + increase
def reset_message_count(self) -> None:
"""Resets the message type count of the stats object"""