Skip to content

Fix usage of Resolve-RepositoryElements -DisableValidation #243

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

Merged
merged 4 commits into from
Jun 21, 2020

Conversation

HowardWolosky
Copy link
Member

@HowardWolosky HowardWolosky commented Jun 20, 2020

Description

There are only four legitimate instances in the module as of today where we should be disabling the validation that Resolve-RepositoryElements provides. All other instances were likely introduced due to mistaken copy/paste issues.

The only reason we'd want to disable the validation is if there are multiple parametersets that need to be considered for the function, where at least one would require OwnerName/RepositoryName while at least one other one would not.

This would have meant that we would have attempted to call those GitHub endpoints with incomplete path information which would have most likely resulted in an error that we could have caught sooner without needing to invoke a web request.

I've fixed up all of these incorrect instances, and added a comment to the two remaining ones to remind others later on why that switch is being used, and help prevent incorrect usage in the future.

I've also cleaned up unnecessary passing of BoundParameters since it already does the correct thing by default.

Issues Fixed

None

References

n/a

Checklist

  • You actually ran the code that you just wrote, especially if you did just "one last quick change".
  • [] Comment-based help added/updated, including examples.
  • Static analysis is reporting back clean.
  • New/changed code adheres to our coding guidelines.
  • New/changed code continues to support the pipeline.
  • Changes to the manifest file follow the manifest guidance.
  • Unit tests were added/updated and are all passing. See testing guidelines. This includes making sure thatall pipeline input variations have been covered.
  • Relevant usage examples have been added/updated in USAGE.md.
  • If desired, ensure your name is added to our Contributors list

There are only two legitimate instances in the module as of today
where we should be disabling the validation that Resolve-RepositoryElements
provides.  All other instances were likely introduced due to mistaken
copy/paste issues.

The only reason we'd want to disable the validation is if there are
multiple parametersets that need to be considered for the function,
where at least one _would_ require `OwnerName`/`RepositoryName` while
at least one other one _would not_.

This would have meant that we would have attempted to call those
GitHub endpoints with incomplete path information which would have
most likely resulted in an error that we could have caught sooner
without needing to invoke a web request.

I've fixed up all of these incorrect instances, and added a comment
to the two remaining ones to remind others later on why that switch
is being used, and help prevent incorrect usage in the future.
@HowardWolosky HowardWolosky added the bug This relates to a bug in the existing module. label Jun 20, 2020
@HowardWolosky
Copy link
Member Author

/azp run PowerShellForGitHub-CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HowardWolosky
Copy link
Member Author

/azp run PowerShellForGitHub-CI

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@HowardWolosky HowardWolosky merged commit 2385b5c into microsoft:master Jun 21, 2020
@HowardWolosky HowardWolosky deleted the disableValidation branch June 21, 2020 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This relates to a bug in the existing module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant