From af7178f2fe8027082bba407cf877eabd5013ad05 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Tue, 10 Nov 2015 21:59:54 +0100 Subject: [PATCH] scanner: Ignore certain binary executable files These were warnings, so the behaviour doesn't really change. --- fdroidserver/scanner.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 092c23ec..e4b405ba 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -138,6 +138,19 @@ def scan_source(build_dir, root_dir, thisbuild): d = f.read(1024) return bool(d.translate(None, textchars)) + # False positives patterns for files that are binary and executable. + safe_paths = [re.compile(r) for r in [ + r".*/drawable[^/]*/.*\.png$", # png drawables + r".*/mipmap[^/]*/.*\.png$", # png mipmaps + ] + ] + + def safe_path(path): + for sp in safe_paths: + if sp.match(path): + return True + return False + gradle_compile_commands = get_gradle_compile_commands(thisbuild) def is_used_by_gradle(line): @@ -208,7 +221,7 @@ def scan_source(build_dir, root_dir, thisbuild): count += handleproblem('binary', fd, fp) elif is_executable(fp): - if is_binary(fp): + if is_binary(fp) and not safe_path(fd): warnproblem('possible binary', fd) for p in scanignore: -- 2.30.2