From 8ed7286c903c611329c15fd98cbebb99b2da4026 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Sat, 10 Feb 2024 21:28:47 +0100 Subject: [PATCH 1/2] Show offending lines for 'more_set_headers' --- package_linter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package_linter.py b/package_linter.py index 4eac4e7..100c4ea 100755 --- a/package_linter.py +++ b/package_linter.py @@ -1421,13 +1421,15 @@ class Configurations(TestSuite): r"more_set_headers [\"\'][\w-]+\s?: .*[\"\'];", line ) - if any(not right_syntax(line) for line in more_set_headers_lines): + lines = [line.strip() for line in more_set_headers_lines if not right_syntax(line)] + if lines: yield Error( "It looks like the syntax for the 'more_set_headers' " "instruction is incorrect in the NGINX conf (N.B. " ": it's different than the 'add_header' syntax!)... " "The syntax should look like: " 'more_set_headers "Header-Name: value"' + f"Offending line(s) [{lines}]" ) @test() From 78b395ea68b08021dbf8e4b2b06d644a11b73149 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:08:14 +0100 Subject: [PATCH 2/2] Update package_linter.py --- package_linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package_linter.py b/package_linter.py index 100c4ea..d4d0b3c 100755 --- a/package_linter.py +++ b/package_linter.py @@ -1429,7 +1429,7 @@ class Configurations(TestSuite): ": it's different than the 'add_header' syntax!)... " "The syntax should look like: " 'more_set_headers "Header-Name: value"' - f"Offending line(s) [{lines}]" + f"\nOffending line(s) [{lines}]" ) @test()