From ed392f0e4ea5df0a639c861b8e419eee3a88a3a3 Mon Sep 17 00:00:00 2001 From: Moul Date: Sat, 28 Jan 2017 12:01:49 +0100 Subject: [PATCH] [enh] #17: check 'set -(e)u': check it's present on five first lines. --- package_linter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package_linter.py b/package_linter.py index 2c770d7..348cb4d 100755 --- a/package_linter.py +++ b/package_linter.py @@ -275,14 +275,16 @@ def check_set_usage(script_name, script): present = False 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: present = True break + if line_nbr > 5: + break if present: - print_right(set_val + " is present") + print_right(set_val + " is present at beginning of file") 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 return_code