mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
[enh] also check 'ynh_die' helper, as 'exit' command,…
…is used before system modifications.
This commit is contained in:
parent
468e6ff936
commit
b89eb4c3e8
1 changed files with 3 additions and 3 deletions
|
@ -181,7 +181,7 @@ def check_verifications_done_before_modifying_system(script):
|
||||||
"""
|
"""
|
||||||
ex, i = 0, 0
|
ex, i = 0, 0
|
||||||
while i < len(script):
|
while i < len(script):
|
||||||
if "exit" in script[i]:
|
if "ynh_die" in script[i] or "exit" in script[i]:
|
||||||
ex = i
|
ex = i
|
||||||
i += 1
|
i += 1
|
||||||
cmd = ("cp", "mkdir", "rm", "chown", "chmod", "apt-get", "apt", "service",
|
cmd = ("cp", "mkdir", "rm", "chown", "chmod", "apt-get", "apt", "service",
|
||||||
|
@ -198,12 +198,12 @@ def check_verifications_done_before_modifying_system(script):
|
||||||
i += 1
|
i += 1
|
||||||
if ok == 0:
|
if ok == 0:
|
||||||
print(c.FAIL + "✘ At line", ex + 1,
|
print(c.FAIL + "✘ At line", ex + 1,
|
||||||
"'exit' command is executed with system modification before.")
|
"'ynh_die' or 'exit' command is executed with system modification before.")
|
||||||
print("This system modification is an issue if a verification exit the script.")
|
print("This system modification is an issue if a verification exit the script.")
|
||||||
print("You should move this verification before any system modification." + c.END)
|
print("You should move this verification before any system modification." + c.END)
|
||||||
else:
|
else:
|
||||||
print_right(
|
print_right(
|
||||||
"Verifications (with exit commands) are done before any system modification.")
|
"Verifications (with 'ynh_die' or 'exit' commands) are done before any system modification.")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
os.system("clear")
|
os.system("clear")
|
||||||
|
|
Loading…
Reference in a new issue