Skip to content

Commit 2e94516

Browse files
author
Gerit Wagner
committed
linter: fix platform selection
1 parent 9799189 commit 2e94516

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

search_query/linter.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
from search_query.utils import format_query_string_pos
1212

1313

14-
def run_linter(search_string: str, syntax: str) -> list:
14+
def run_linter(search_string: str, platform: str) -> list:
1515
"""Run the linter on the search string"""
1616

17-
parser = search_query.parser.PARSERS[syntax](search_string)
17+
parser = search_query.parser.PARSERS[platform](search_string)
1818
try:
1919
parser.parse()
2020
except Exception: # pylint: disable=broad-except
@@ -34,7 +34,14 @@ def pre_commit_hook() -> int:
3434
print(e)
3535
return ExitCodes.FAIL
3636

37-
linter_messages = run_linter(search_file.search_string, search_file.search_string)
37+
if platform not in search_query.parser.PARSERS:
38+
print(
39+
f"Unknown platform: {platform}."
40+
f"Must be one of {search_query.parser.PARSERS}"
41+
)
42+
return ExitCodes.FAIL
43+
44+
linter_messages = run_linter(search_file.search_string, platform)
3845

3946
if linter_messages:
4047
for message in linter_messages:

0 commit comments

Comments
 (0)