-
Notifications
You must be signed in to change notification settings - Fork 3
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
[SOAR-12421] Name Validator #158
Conversation
raise ValidationException("Name should not contain any whitespace characters.") | ||
if not name.replace("_", "").isalnum(): | ||
raise ValidationException("Name should only contain alphanumeric values.") | ||
if len(name.split("_")) > 7: |
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.
Unsure if this is a better change lemme know what you think
if len(name.split("_")) > 7: | |
len_name = len(name.split("_")) | |
if len_name > 7: |
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.
And obviously put the len_name variable at the top somewhere.
if len(name.split("_")) > 7: | ||
raise ValidationException(f"Name is too long, 7 words or less: contains {str(len(name.split('_')))}") |
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.
if len(name.split("_")) > 7: | |
raise ValidationException(f"Name is too long, 7 words or less: contains {str(len(name.split('_')))}") | |
if len_name > 7: | |
raise ValidationException(f"Name is too long, 7 words or less: contains {str(len(name.split('_')))}") |
raise ValidationException("Plugin name is missing.") | ||
try: | ||
NameValidator.validate_name(spec.spec_dictionary()["name"], plugin_name=True) | ||
except Exception as error: |
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.
Is it possible to specify the type of error here or is it better to handle all exceptions and assume they are related to plugin name not found
Proposed Changes
Description
Describe the proposed changes:
PR Requirements
Developers, verify you have completed the following items by checking them off: