ENT-13089: Added validation of module names#247
Merged
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
approved these changes
Jul 4, 2025
olehermanse
left a comment
Member
There was a problem hiding this comment.
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. |
Member
There was a problem hiding this comment.
Suggested change
| 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. |
Comment on lines
+189
to
+190
| if not name.startswith("./"): | ||
| raise CFBSValidationError(name, "Local module names should begin with `./`") |
Member
There was a problem hiding this comment.
This is ensured by is_module_local(), so should be an assert / programmer error if that's not the case:
Suggested change
| 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 ./" |
Contributor
Author
There was a problem hiding this comment.
Yes, but I thought this is safer since the implementation could change in the future.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.