Skip to content

Commit

Permalink
Change: script_calls_recommended group2 regex to match multilne
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHargarter authored and mbrinkhoff committed Sep 10, 2024
1 parent 4bb1ac3 commit 63b5a34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions tests/plugins/test_script_calls_recommended.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ def test_missing_calls(self):

def test_dependencies_multiline(self):
content = (
# tests group1
' script_dependencies("123",\n"456");\n'
" script_require_ports();\n"
" script_require_udp_ports();\n"
" script_require_keys();\n"
" script_mandatory_keys();\n"
# tests group2
' script_mandatory_keys("foo",\n"bar");\n'
)
fake_context = self.create_file_plugin_context(
nasl_file=self.path, file_content=content
Expand Down
4 changes: 3 additions & 1 deletion troubadix/plugins/script_calls_recommended.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ def check_content(
]

if not _get_special_script_tag_pattern(
name=rf"({'|'.join(recommended_many_call)})", value=".*"
name=rf"({'|'.join(recommended_many_call)})",
value=".*?",
flags=re.DOTALL,
).search(file_content):
yield LinterWarning(
"VT contains none of the following recommended calls: "
Expand Down

0 comments on commit 63b5a34

Please sign in to comment.