From: Daniel Martí Date: Sat, 5 Jul 2014 12:04:51 +0000 (+0200) Subject: Use counters in lint X-Git-Tag: 0.2.1~38 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8249324a7ba0e1d17821a0f176aa8c27e889ea40;p=fdroidserver.git Use counters in lint --- diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 123a6441..d265bfb5 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -22,6 +22,7 @@ import re import logging import common import metadata +from collections import Counter config = None options = None @@ -129,20 +130,19 @@ regex_pedantic = { def main(): - global config, options, appid, app_count, warn_count + global config, options, appid, count appid = None - app_count = 0 - warn_count = 0 + count = Counter() def warn(message): - global appid, app_count, warn_count + global appid, count if appid: print "%s:" % appid appid = None - app_count += 1 + count['app'] += 1 print ' %s' % message - warn_count += 1 + count['warn'] += 1 def pwarn(message): if options.pedantic: @@ -246,7 +246,7 @@ def main(): if not appid: print - logging.info("Found a total of %i warnings in %i apps." % (warn_count, app_count)) + logging.info("Found a total of %i warnings in %i apps." % (count['warn'], count['app'])) if __name__ == "__main__": main()