chiark / gitweb /
scanner: ignore gradle comment lines
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 8 Oct 2015 10:16:45 +0000 (12:16 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 8 Oct 2015 10:16:45 +0000 (12:16 +0200)
Useful to detect:

maven {
// foo
url "http://foo.bar"
}

fdroidserver/scanner.py

index 5587bd4bb305c0c4a5c5b3ba72ef14a95803df5b..ab41030121f6570474b6e99326653e8ede22d1b6 100644 (file)
@@ -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):