Skip to content

Commit 1641c43

Browse files
Added the fix to add missing project length validation.
Addressing the issue - feast-dev#4626 Signed-off-by: lrangine <[email protected]>
1 parent 85f8895 commit 1641c43

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎sdk/python/feast/repo_operations.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,11 @@ def init_repo(repo_name: str, template: str):
504504
def is_valid_name(name: str) -> bool:
505505
"""A name should be alphanumeric values and underscores but not start with an underscore"""
506506
return (
507-
len(name) <= 16 and # the name is not greater than 16 characters
508-
not name.startswith("_") and # name does not start with an underscore
509-
re.match(r"^[a-zA-Z0-9_]+$", name) is not None # Ensures it only contains alphanumeric and _
510-
)
507+
len(name) <= 16 # the name is not greater than 16 characters
508+
and not name.startswith("_") # name does not start with an underscore
509+
and re.match(r"^[a-zA-Z0-9_]+$", name)
510+
is not None # Ensures it only contains alphanumeric and _
511+
)
511512

512513

513514
def generate_project_name() -> str:

‎sdk/python/tests/unit/sdk/python/feast/test_repo_operations_validate_feast_project_name.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ def test_is_valid_name():
99
("valid123", True),
1010
("1234567890123456", True),
1111
("invalid_name_", True),
12-
1312
# Invalid project name cases
1413
("_invalidName", False),
1514
("invalid-Name", False),
@@ -22,4 +21,6 @@ def test_is_valid_name():
2221
]
2322

2423
for name, expected in test_cases:
25-
assert is_valid_name(name) == expected, f"Failed for project invalid name: {name}"
24+
assert (
25+
is_valid_name(name) == expected
26+
), f"Failed for project invalid name: {name}"

0 commit comments

Comments
 (0)