Skip to content
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

Merged
merged 15 commits into from Sep 27, 2018

Conversation

Projects
None yet
3 participants
@jgsogo
Copy link
Member

commented Sep 26, 2018

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

@jgsogo jgsogo added this to the 1.9 milestone Sep 26, 2018

@jgsogo jgsogo requested a review from lasote Sep 26, 2018

@ghost ghost assigned jgsogo Sep 26, 2018

@ghost ghost added the stage: review label Sep 26, 2018

@@ -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):

This comment has been minimized.

Copy link
@danimtb

danimtb Sep 26, 2018

Member

Should validate defaulted to False and only validate in the ConanFileReference loading points?

This comment has been minimized.

Copy link
@jgsogo

jgsogo Sep 26, 2018

Author Member

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.

@lasote

lasote approved these changes Sep 26, 2018

@danimtb

This comment has been minimized.

Copy link
Member

commented Sep 27, 2018

Updated PR description with changelog. Feel free to change it if not accurate enough

@danimtb danimtb merged commit 2b2058b into conan-io:develop Sep 27, 2018

2 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details

@ghost ghost removed the stage: review label Sep 27, 2018

@lasote lasote removed this from the 1.9 milestone Sep 27, 2018

@lasote lasote added this to the 1.8 milestone Sep 27, 2018

@jgsogo jgsogo deleted the jgsogo:engineering/3509 branch Sep 27, 2018

grisumbras pushed a commit to grisumbras/conan that referenced this pull request Dec 27, 2018

Validate ConanFileReference only if requested (conan-io#3623)
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.