-
Notifications
You must be signed in to change notification settings - Fork 13
ENT-13089: Added validation of module names #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
olehermanse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Only small comments, feel free to fix in a follow-up PR.
| For the `build` array, it must be inside each module object (with `name` as the key). | ||
| Local modules (files and folders in same directory as `cfbs.json`), must start with `./`, and end with `/` if it's a directory. | ||
| Module names should not be longer than 64 characters. | ||
| Module names (not including adfixes `./`, `/`, `.cf`, `.json` for local modules) should only contain lowercase ASCII alphanumeric characters possibly separated by dashes, and should start with a letter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Module names (not including adfixes `./`, `/`, `.cf`, `.json` for local modules) should only contain lowercase ASCII alphanumeric characters possibly separated by dashes, and should start with a letter. | |
| Module names (not including affixes `./`, `/`, `.cf`, `.json` for local modules) should only contain lowercase ASCII alphanumeric characters possibly separated by dashes, and should start with a letter. |
| if not name.startswith("./"): | ||
| raise CFBSValidationError(name, "Local module names should begin with `./`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ensured by is_module_local(), so should be an assert / programmer error if that's not the case:
| if not name.startswith("./"): | |
| raise CFBSValidationError(name, "Local module names should begin with `./`") | |
| assert name.startswith("./"), "is_module_local() should ensure this module starts with ./" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I thought this is safer since the implementation could change in the future.
No description provided.