Skip to content

Commit fc68d91

Browse files
authored
Merge pull request #521 from DharunMR/added-logging
2 parents a973b34 + ee67d17 commit fc68d91

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

fortls/regex_patterns.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from __future__ import annotations
22

3+
import logging
34
from dataclasses import dataclass
45
from re import I, compile
56
from typing import Pattern
67

8+
log = logging.getLogger(__name__)
9+
710

811
@dataclass(frozen=True)
912
class FortranRegularExpressions:
@@ -199,7 +202,7 @@ def create_src_file_exts_regex(input_exts: list[str] = []) -> Pattern[str]:
199202
# Add its expression as an OR and force they match the end of the string
200203
return re.compile(rf"(({'$)|('.join(EXPRESSIONS)}$))")
201204
except re.error:
202-
# TODO: Add a warning to the logger
205+
log.warning("Invalid REGEX provided for file %s", input_exts, exc_info=True)
203206
return re.compile(rf"({DEFAULT}$)")
204207

205208

test/test_regex_patterns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
([], ["test.ff", "test.f901", "test.f90.ff"], [False, False, False]),
3434
([r"\.inc"], ["test.inc", "testinc", "test.inc2"], [True, False, False]),
3535
(["inc.*"], ["test.inc", "testinc", "test.inc2"], [True, True, True]),
36+
(["("], ["test.f90", "test.f90.ff"], [True, False]),
3637
],
3738
)
3839
def test_src_file_exts(

0 commit comments

Comments
 (0)