-
Notifications
You must be signed in to change notification settings - Fork 993
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
Validate ConanFileReference only if requested #3623
Conversation
@@ -61,25 +61,29 @@ class ConanFileReference(namedtuple("ConanFileReference", "name version user cha | |||
sep_pattern = re.compile("@|/|#") | |||
revision = None | |||
|
|||
def __new__(cls, name, version, user, channel, revision=None): | |||
def __new__(cls, name, version, user, channel, revision=None, validate=True): |
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.
Should validate
defaulted to False and only validate in the ConanFileReference loading points?
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.
I feel safer if we keep the previous behavior (always validating), at least in this pull request. Afterward, we can force it to be explicit and decide at each point if validation is needed or not.
Updated PR description with changelog. Feel free to change it if not accurate enough |
* check that parameters are string before applying regex match * add tests related to ConanName * typo * update docs related to function * use six to check for string types * use a custom message to validate each field * refactor tests to validate custom messages * fix tests: message is more explicit * given conan-io#3464 this is dead code * format error message only if we are actually going to use it * minor changes: address @lasote review * optional validation of conanfile reference
Closes #3509
This could speed things up a little bit if passing
validate=False
, current implementation add this flexibility while preserving existing behavior.Changelog: Feature: Validate parameter for ConanFileReference objects to avoid unnecessary checks