Index: /trunk/cheesecake/cheesecake_index.py =================================================================== --- /trunk/cheesecake/cheesecake_index.py (revision 170) +++ /trunk/cheesecake/cheesecake_index.py (revision 172) @@ -1125,8 +1125,28 @@ """ name = "pep8" - max_value = 0 + + # + # Max value is a number of possible pep8 errors times 2, + # plus number of possible pep8 warnings. + # + # Currently pep8 module support 15 errors: + # E101, + # E111, E112, E113, + # E201, E202, E203, + # E211, + # E221, E222, + # E301, E302, E303, + # E401, + # E501 + # and 4 warnings: + # W191, + # W291, + # W601, + # W602 + # + max_value = 34 + error_score = -2 warning_score = -1 - def compute(self, files_list, package_dir): @@ -1145,9 +1165,13 @@ error_stats = pep8.get_error_statistics() warning_stats = pep8.get_warning_statistics() + errors = len(error_stats) warnings = len(warning_stats) + total_error_score = self.error_score * errors total_warning_score = self.warning_score * warnings + score = total_error_score + total_warning_score + self.value = self.max_value + score self.add_info("Errors:") @@ -1163,7 +1187,6 @@ self.add_info("pep8.py found %d warning types; we're scoring %d per warning type" % (warnings, self.warning_score)) self.add_info("Warning score: %d" % total_warning_score) - self.add_info("Total pep8 score: %d" % score) - - self.value = score + self.add_info("Total pep8 score: %d - %d = %d" % (self.max_value, abs(score), self.value)) + self.details = "pep8.py check: %d error types, %d warning types" % (errors, warnings) return self.value