mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 15:30:28 +03:00
scanner: Ignore certain binary executable files
These were warnings, so the behaviour doesn't really change.
This commit is contained in:
parent
c94b0342ad
commit
af7178f2fe
1 changed files with 14 additions and 1 deletions
|
|
@ -138,6 +138,19 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
d = f.read(1024)
|
d = f.read(1024)
|
||||||
return bool(d.translate(None, textchars))
|
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)
|
gradle_compile_commands = get_gradle_compile_commands(thisbuild)
|
||||||
|
|
||||||
def is_used_by_gradle(line):
|
def is_used_by_gradle(line):
|
||||||
|
|
@ -208,7 +221,7 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
count += handleproblem('binary', fd, fp)
|
count += handleproblem('binary', fd, fp)
|
||||||
|
|
||||||
elif is_executable(fp):
|
elif is_executable(fp):
|
||||||
if is_binary(fp):
|
if is_binary(fp) and not safe_path(fd):
|
||||||
warnproblem('possible binary', fd)
|
warnproblem('possible binary', fd)
|
||||||
|
|
||||||
for p in scanignore:
|
for p in scanignore:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue