mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
Remove commented lines when reading file in raw mode
This commit is contained in:
parent
c7f40ca566
commit
5a45d7b7bb
1 changed files with 5 additions and 4 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue