Remove commented lines when reading file in raw mode

This commit is contained in:
Alexandre Aubin 2019-01-28 20:35:07 +01:00
parent c7f40ca566
commit 5a45d7b7bb

View file

@ -87,14 +87,15 @@ def check_file_exist(file_path):
def read_file(file_path): def read_file(file_path):
f = open(file_path) f = open(file_path)
# remove every comments and empty lines from the file content to avoid
# false positives
file = shlex.shlex(f, False) file = shlex.shlex(f, False)
#file = filter(None, re.sub("#.*[^\n]", "", f.read()).splitlines())
return file return file
def read_file_raw(file_path): def read_file_raw(file_path):
return open(file_path).read() # remove every comments and empty lines from the file content to avoid
# false positives
f = open(file_path)
file = "\n".join(filter(None, re.sub("#.*[^\n]", "", f.read()).splitlines()))
return file
def check_source_management(app_path): def check_source_management(app_path):