From 7110959e51af5563b44235dc8024effdfbee36a0 Mon Sep 17 00:00:00 2001 From: oleole39 <59071673+oleole39@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:13:30 +0100 Subject: [PATCH] Fix regex for source Current regex will match any of the ten line after the official helper files starting with the string "source". Thus, in my specific case for which I declare a variable named source_filename="{...}", the linter will display a warning for it: ` ! Please avoid sourcing additional helpers after the official helpers (in this case file _filename=$(basename$upstream__url)) `. As it should be only interested in matching the command `source` (`source path/to/file`), a space should be appended to the current regex. --- package_linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package_linter.py b/package_linter.py index 865d15b..2fcb02e 100755 --- a/package_linter.py +++ b/package_linter.py @@ -2797,7 +2797,7 @@ class Script(TestSuite): @test() def helpers_sourcing_after_official(self): helpers_after_official = subprocess.check_output( - "head -n 30 '%s' | grep -A 10 '^ *source */usr/share/yunohost/helpers' | grep '^ *source' | tail -n +2" + "head -n 30 '%s' | grep -A 10 '^ *source */usr/share/yunohost/helpers' | grep '^ *source ' | tail -n +2" % self.path, shell=True, ).decode("utf-8")