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] 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()