Skip to content

Conversation

@gkreitz
Copy link
Contributor

@gkreitz gkreitz commented Nov 28, 2025

Kattis/problem-package-format#453 has now been resolved, and the regex for file and directory names in the new standard is more permissive.

This PR adopts the new regex for both legacy and the new standard, as I see no reason not to fix this also for legacy. This PR also treats directory names not matching the regex as an error in legacy (it is currently only a warning in legacy). I've added a PR to the standard to make these changes to the standard doc, Kattis/problem-package-format#526 .

This PR also removes an old regex for when searching for permissions, which predates the more general requirements on all file names in a package. Sorry to those who named their C++ files as .c++, that's no longer allowed. :)

def _check_file_and_directory_names(self):
filename_regex = re.compile(r'^[a-z0-9][a-z0-9_.-]{0,253}[a-z0-9]$', re.I)
directory_regex = re.compile(r'^[a-z0-9]([a-z0-9_-]{0,253}[a-z0-9])?$', re.I)
regex = re.compile(r'^[a-zA-Z0-9_][a-zA-Z0-9_.-]{0,254}$')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I understand the logic, we might want a somewhat more descriptive variable name ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine. It's a local variable in a function called "_check_file_and_directory_names".

@gkreitz gkreitz merged commit f05b18d into Kattis:master Nov 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants