--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py Thu Apr 08 18:27:47 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleStatisticsDialog.py Fri Apr 09 18:13:36 2021 +0200 @@ -30,7 +30,9 @@ Constructor @param statistics dictionary with the statistical data - @param parent reference to the parent widget (QWidget) + @type dict + @param parent reference to the parent widget + @type QWidget """ super(CodeStyleStatisticsDialog, self).__init__(parent) self.setupUi(self) @@ -39,15 +41,14 @@ filesCount = stats["_FilesCount"] filesIssues = stats["_FilesIssues"] fixesCount = stats["_IssuesFixed"] - ignoresCount = stats["_IgnoredErrors"] securityOk = stats["_SecurityOK"] del stats["_FilesCount"] del stats["_FilesIssues"] del stats["_IssuesFixed"] - del stats["_IgnoredErrors"] del stats["_SecurityOK"] totalIssues = 0 + ignoresCount = 0 textWrapper = textwrap.TextWrapper(width=80) @@ -58,7 +59,8 @@ self.__createItem(stats[code], code, "\n".join(textWrapper.wrap(message))) - totalIssues += stats[code] + totalIssues += stats[code]["total"] + ignoresCount += stats[code]["ignored"] self.totalIssues.setText( self.tr("%n issue(s) found", "", totalIssues)) @@ -75,33 +77,41 @@ self.statisticsList.resizeColumnToContents(0) self.statisticsList.resizeColumnToContents(1) + self.statisticsList.resizeColumnToContents(2) - def __createItem(self, count, code, message): + def __createItem(self, counts, code, message): """ Private method to create an entry in the result list. - @param count occurrences of the issue (integer) - @param code of a code style issue message (string) - @param message code style issue message to be shown (string) + @param counts dictionary containing the total and ignored occurrences + of the issue + @type dict + @param code of a code style issue message + @type str + @param message code style issue message to be shown + @type str """ itm = QTreeWidgetItem(self.statisticsList, [ - "{0:6d}".format(count), code, message]) + code, "{0:6d}".format(counts["total"] - counts["ignored"]), + "{0:6d}".format(counts["ignored"]), message]) if code.startswith(("W", "C", "M")): - itm.setIcon(1, UI.PixmapCache.getIcon("warning")) + itm.setIcon(0, UI.PixmapCache.getIcon("warning")) elif code.startswith("E"): - itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError")) + itm.setIcon(0, UI.PixmapCache.getIcon("syntaxError")) elif code.startswith("N"): - itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) + itm.setIcon(0, UI.PixmapCache.getIcon("namingError")) elif code.startswith("D"): - itm.setIcon(1, UI.PixmapCache.getIcon("docstringError")) + itm.setIcon(0, UI.PixmapCache.getIcon("docstringError")) elif code.startswith("S"): - itm.setIcon(1, UI.PixmapCache.getIcon("securityLow")) + itm.setIcon(0, UI.PixmapCache.getIcon("securityLow")) elif code.startswith("P"): - itm.setIcon(1, UI.PixmapCache.getIcon("dirClosed")) + itm.setIcon(0, UI.PixmapCache.getIcon("dirClosed")) elif code.startswith("Y"): - itm.setIcon(1, UI.PixmapCache.getIcon("filePython")) + itm.setIcon(0, UI.PixmapCache.getIcon("filePython")) itm.setTextAlignment( - 0, Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter) + 0, Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) itm.setTextAlignment( - 1, Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter) + 1, Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter) + itm.setTextAlignment( + 2, Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter)