Skip to content

Commit

Permalink
Change: Change spaces_in_filename plugin to include all whitespace ch…
Browse files Browse the repository at this point in the history
…aracters
  • Loading branch information
NiklasHargarter committed Apr 29, 2024
1 parent b12552b commit 33699b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/plugins/test_spaces_in_filename.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ def test_fail(self):
self.assertIsInstance(results[0], LinterError)
self.assertEqual(
results[0].message,
f"The VT {nasl_file} contains spaces in the filename",
f"The VT {nasl_file} contains whitespace in the filename",
)
5 changes: 3 additions & 2 deletions troubadix/plugins/spaces_in_filename.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2024 Greenbone AG

import re
from typing import Iterator

from troubadix.plugin import FilePlugin, LinterError, LinterResult
Expand All @@ -10,10 +11,10 @@ class CheckSpacesInFilename(FilePlugin):
name = "check_spaces_in_filename"

def run(self) -> Iterator[LinterResult]:
if " " in self.context.nasl_file.name:
if re.search(r"\s", self.context.nasl_file.name):
yield LinterError(
f"The VT {self.context.nasl_file}"
" contains spaces in the filename",
" contains whitespace in the filename",
file=self.context.nasl_file,
plugin=self.name,
)

0 comments on commit 33699b6

Please sign in to comment.