From: Daniel Martí Date: Thu, 8 Oct 2015 10:16:45 +0000 (+0200) Subject: scanner: ignore gradle comment lines X-Git-Tag: 0.5.0~48 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f7e902221717825810f5a1e989e52c50554d1b6c;p=fdroidserver.git scanner: ignore gradle comment lines Useful to detect: maven { // foo url "http://foo.bar" } --- diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 5587bd4b..ab410301 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -191,7 +191,8 @@ def scan_source(build_dir, root_dir, thisbuild): if is_used_by_gradle(line): for name in suspects_found(line): count += handleproblem('usual supect \'%s\' at line %d' % (name, i+1), fd, fp) - joined = re.sub(r'[\n\r\s]+', ' ', ' '.join(lines)) + noncomment_lines = [l for l in lines if not common.gradle_comment.match(l)] + joined = re.sub(r'[\n\r\s]+', ' ', ' '.join(noncomment_lines)) for m in gradle_mavenrepo.finditer(joined): url = m.group(2) if not any(r.match(url) for r in allowed_repos):