diff options
Diffstat (limited to 'pylint/utils.py')
-rw-r--r-- | pylint/utils.py | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/pylint/utils.py b/pylint/utils.py index f8baa96a7..56f8c5f96 100644 --- a/pylint/utils.py +++ b/pylint/utils.py @@ -287,6 +287,7 @@ class MessagesHandlerMixIn: self.msg_status = 0 self.msgs_store = MessagesStore() self.reporter = None + self.stats = {"by_module": {}, "by_msg": {}} super().__init__() def _checker_messages(self, checker): @@ -364,13 +365,7 @@ class MessagesHandlerMixIn: self._set_msg_status(_msgid, enable, scope, line) return - # msgid is report id? - if msgid.lower().startswith("rp"): - if enable: - self.enable_report(msgid) - else: - self.disable_report(msgid) - return + # TODO: Need to add enable/disable report back? try: # msgid is a symbolic or numeric msgid. @@ -1057,9 +1052,7 @@ class MessagesStore: class ReportsHandlerMixIn: - """a mix-in class containing all the reports and stats manipulation - related methods for the main lint class - """ + """A report handlers organises and calls report methods.""" _POST_CHECKER = object() @@ -1120,6 +1113,12 @@ class ReportsHandlerMixIn: reportid = reportid.upper() self._reports_state[reportid] = False + def disable_reporters(self): + """Disable all reporters.""" + for _reporters in self._reports.values(): + for report_id, _, _ in _reporters: + self.disable_report(report_id) + def report_is_enabled(self, reportid): """return true if the report associated to the given identifier is enabled @@ -1128,7 +1127,7 @@ class ReportsHandlerMixIn: def make_reports(self, stats, old_stats): """render registered reports""" - sect = Section("Report", "%s statements analysed." % (self.stats["statement"])) + sect = Section("Report", "%s statements analysed." % (stats["statement"])) for checker in self.report_order(): for reportid, r_title, r_cb in self._reports[checker]: if not self.report_is_enabled(reportid): @@ -1142,17 +1141,6 @@ class ReportsHandlerMixIn: sect.append(report_sect) return sect - def add_stats(self, **kwargs): - """add some stats entries to the statistic dictionary - raise an AssertionError if there is a key conflict - """ - for key, value in kwargs.items(): - if key[-1] == "_": - key = key[:-1] - assert key not in self.stats - self.stats[key] = value - return self.stats - def _basename_in_blacklist_re(base_name, black_list_re): """Determines if the basename is matched in a regex blacklist |