Skip to content

Commit 57ca0db

Browse files
committed
restric problem name
1 parent eac8c65 commit 57ca0db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/problem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def is_legacy(self):
380380

381381
# A problem.
382382
class Problem:
383-
_SHORTNAME_REGEX_STRING: Final[str] = "^[a-z0-9]+$"
383+
_SHORTNAME_REGEX_STRING: Final[str] = "[a-z0-9]{2,255}"
384384
_SHORTNAME_REGEX: Final[re.Pattern[str]] = re.compile(_SHORTNAME_REGEX_STRING)
385385

386386
def __init__(self, path: Path, tmpdir: Path, label: Optional[str] = None):
@@ -414,7 +414,7 @@ def __init__(self, path: Path, tmpdir: Path, label: Optional[str] = None):
414414

415415
# TODO: transform this into nice warnings
416416
assert path.is_dir()
417-
if not Problem._SHORTNAME_REGEX.match(self.name):
417+
if not Problem._SHORTNAME_REGEX.fullmatch(self.name):
418418
warn(
419419
f"Problem has a bad shortname: {self.name} does not match {self._SHORTNAME_REGEX_STRING}"
420420
)

0 commit comments

Comments
 (0)