Skip to content

Commit bfea000

Browse files
fix cleaning of external prefix (#68)
1 parent 7cf5acd commit bfea000

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/extensions/score_metamodel/checks/check_options.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ def remove_prefix(word: str, prefixes: list[str]) -> str:
7777
values = [str(raw_value)]
7878

7979
# The filter ensures that the function is only called when needed.
80-
8180
for value in values:
82-
if field_type == "link" and allowed_prefixes:
81+
if allowed_prefixes:
8382
value = remove_prefix(value, allowed_prefixes)
8483
try:
8584
if not re.match(pattern, value):

src/extensions/score_metamodel/tests/test_check_options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def test_missing_mandatory_options_info(self):
141141
app = Mock(spec=Sphinx)
142142
app.config = Mock()
143143
app.config.needs_types = self.NEED_TYPE_INFO_WITHOUT_MANDATORY_OPTIONS
144+
app.config.allowed_external_prefixes = []
144145
# Expect that the checks pass
145146
check_options(app, need_1, logger)
146147
logger.assert_warning(
@@ -165,6 +166,7 @@ def test_invalid_option_type(self):
165166
app = Mock(spec=Sphinx)
166167
app.config = Mock()
167168
app.config.needs_types = self.NEED_TYPE_INFO_WITH_INVALID_OPTION_TYPE
169+
app.config.allowed_external_prefixes = []
168170
# Expect that the checks pass
169171
check_options(app, need_1, logger)
170172
logger.assert_warning(
@@ -190,6 +192,7 @@ def test_unknown_option_present_in_neither_req_opt_neither_opt_opt(self):
190192
app = Mock(spec=Sphinx)
191193
app.config = Mock()
192194
app.config.needs_types = self.NEED_TYPE_INFO_WITH_OPT_OPT
195+
app.config.allowed_external_prefixes = []
193196
# Expect that the checks pass
194197
check_extra_options(app, need_1, logger)
195198

0 commit comments

Comments
 (0)