mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
add check ./common.sh
cf kay0u ;-)
This commit is contained in:
parent
9f32e06dcc
commit
46e6439233
1 changed files with 3 additions and 3 deletions
|
@ -518,11 +518,10 @@ class Script():
|
|||
"You can use 'ynh_print_info' or 'ynh_script_progression' for this."
|
||||
)
|
||||
|
||||
|
||||
def check_source_common(self):
|
||||
#test for standard execution
|
||||
if script["name"] in ["install","upgrade","remove"]:
|
||||
count_common=len(re.findall("^source _common.sh",script["raw"],flags=re.MULTILINE))
|
||||
count_common=len(re.findall("^source _common.sh|^source ./_common.sh",script["raw"],flags=re.MULTILINE))
|
||||
if count_common == 0:
|
||||
print_warning("Calling _common.sh seams not present in this script, please add \"source _common.sh\"")
|
||||
elif count_common > 1:
|
||||
|
@ -530,7 +529,7 @@ class Script():
|
|||
|
||||
#test for "save" files
|
||||
else:
|
||||
count_common=len(re.findall("^source _common.sh",script["raw"],flags=re.MULTILINE))
|
||||
count_common=len(re.findall("^source _common.sh|^source ./_common.sh",script["raw"],flags=re.MULTILINE))
|
||||
count_common_save=len(re.findall("^source ../settings/scripts/_common.sh",script["raw"],flags=re.MULTILINE))
|
||||
if count_common > 0 and count_common_save == 0:
|
||||
print_error("You must call _common.sh with \"source ../settings/scripts/_common.sh\" in this script to respect context execution")
|
||||
|
@ -539,6 +538,7 @@ class Script():
|
|||
elif count_common_save > 1:
|
||||
print_warning("Duplicates calls to _common.sh, please clean your code")
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print("Give one app package path.")
|
||||
|
|
Loading…
Reference in a new issue