From: Daniel Martí Date: Wed, 19 Aug 2015 01:07:01 +0000 (-0700) Subject: lint: better type safety X-Git-Tag: 0.5.0~191 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=80371da13384e9bf3c86bad3846860df7bb3b4d1;p=fdroidserver.git lint: better type safety --- diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 9c59fd37..ee6eca7c 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -260,14 +260,14 @@ def main(): # Regex checks in all kinds of fields for f in regex_warnings: for m, r in regex_warnings[f]: - t = metadata.metafieldtype(f) - if t == 'string': - if app[f] is None: + v = app[f] + if type(v) == str: + if v is None: continue - if m.match(app[f]): + if m.match(v): warn("%s '%s': %s" % (f, app[f], r)) - elif t == 'multiline': - for l in app[f]: + elif type(v) == list: + for l in v: if m.match(l): warn("%s at line '%s': %s" % (f, l, r))