Skip to content

Commit 78736a4

Browse files
Isaac-G5900thomas-bcCopilot
authored
Used regex check on project_name in place of .isalnum to fix expected command behavior (#24)
* Used regex check on project_name in place of .isalnum to fix expected command behavior * Update src/fprime_bootstrap/bootstrap_project.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8e189cc commit 78736a4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/fprime_bootstrap/bootstrap_project.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import logging
1212
import subprocess
1313
import sys
14+
import re
1415
from urllib.request import urlopen
1516
from urllib.error import HTTPError
1617
from pathlib import Path
@@ -89,10 +90,10 @@ def bootstrap_project(parsed_args: "argparse.Namespace"):
8990
def check_project_name(project_name: str) -> bool:
9091
"""Checks if a project name is valid. Project name should be a valid
9192
FPP identifier, it should only contain alphanumeric characters and underscores."""
92-
if not project_name.isalnum():
93+
if not re.match(r'^[A-Za-z][A-Za-z0-9_]*$', project_name):
9394
raise InvalidProjectName(
9495
f"Invalid project name: {project_name}. "
95-
"Project name should only contain alphanumeric characters and underscores."
96+
"Project name must start with a letter and only contain alphanumeric characters and underscores."
9697
)
9798

9899

0 commit comments

Comments
 (0)