From 70fe13bd4e56e794242ee74199e417383dfa87e8 Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 23 Mar 2017 19:36:57 +0100 Subject: [PATCH] =?UTF-8?q?[mod]=20#5:=C2=A0remove=20'sudo'=20cmd=20prefix?= =?UTF-8?q?=20check=20for=20YnH=202.6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package_linter.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/package_linter.py b/package_linter.py index fb74126..186b964 100755 --- a/package_linter.py +++ b/package_linter.py @@ -181,7 +181,6 @@ def check_script(path, script_name, script_nbr): script = read_file(script_path) - return_code = check_sudo_prefix_commands(script) or return_code return_code = check_non_helpers_usage(script) or return_code if script_nbr < 5: return_code = check_verifications_done_before_modifying_system(script) or return_code @@ -191,31 +190,6 @@ def check_script(path, script_name, script_nbr): return return_code -def check_sudo_prefix_commands(script): - """ - Check if commands are prefix with "sudo" - """ - cmds = ("rm", "chown", "chmod", "apt-get", "apt", - "service", "yunohost", "find" "swapon", "mkswap", "useradd") # , "dd") cp, mkdir - ok = True - - for line_nbr, line in enumerate(script): - for cmd in cmds: - if cmd + " " in line and "sudo " + cmd + " " not in line \ - and "yunohost service" not in line and "-exec " + cmd not in line \ - and ".service" not in line and line[0] != '#': - print(c.FAIL + "✘ Line ", line_nbr + 1, - "you should add \"sudo\" before this command line:", c.END) - print(" " + line.replace(cmd, - c.BOLD + c.FAIL + cmd + c.END)) - ok = False - if ok: - print_right("All commands are prefix with \"sudo\".") - return 0 - - return 1 - - def check_verifications_done_before_modifying_system(script): """ Check if verifications are done before modifying the system