mirror of
https://github.com/YunoHost/package_linter.git
synced 2024-09-03 20:06:12 +02:00
[enh] #17: check 'set -(e)u': check it's present on five first lines.
This commit is contained in:
parent
be1f2b2eb5
commit
ed392f0e4e
1 changed files with 5 additions and 3 deletions
|
@ -275,14 +275,16 @@ def check_set_usage(script_name, script):
|
||||||
present = False
|
present = False
|
||||||
set_val = "set -u" if script_name == "remove" else "set -eu"
|
set_val = "set -u" if script_name == "remove" else "set -eu"
|
||||||
|
|
||||||
for line in script:
|
for line_nbr, line in enumerate(script):
|
||||||
if set_val in line:
|
if set_val in line:
|
||||||
present = True
|
present = True
|
||||||
break
|
break
|
||||||
|
if line_nbr > 5:
|
||||||
|
break
|
||||||
if present:
|
if present:
|
||||||
print_right(set_val + " is present")
|
print_right(set_val + " is present at beginning of file")
|
||||||
else:
|
else:
|
||||||
print_wrong(set_val + " is missing. For details, look at https://dev.yunohost.org/issues/419")
|
print_wrong(set_val + " is missing at beginning of file. For details, look at https://dev.yunohost.org/issues/419")
|
||||||
return_code = 1
|
return_code = 1
|
||||||
|
|
||||||
return return_code
|
return return_code
|
||||||
|
|
Loading…
Reference in a new issue