Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jun 12, 2021

PR Summary

  • Changes parameter name from command to cmdlet in AddCommand(string command) to match its overload AddCommand(string cmdlet, bool useLocalScope)
  • Fixes a bug where the value passed into the constructor for an Argument Null Exception object does not match the name of the relevant parameter
  • Corrects references to the wrong methods and parameters in the XML comments
  • Improves formatting for code samples in the XML comments

PR Context

Closes #15537

PR Checklist

@ghost ghost assigned anmenaga Jun 12, 2021
@ghost
Copy link

ghost commented Jun 12, 2021

CLA assistant check
All CLA requirements met.

@iSazonov iSazonov requested a review from sdwheeler June 12, 2021 18:44
@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Jun 12, 2021
@iSazonov
Copy link
Collaborator

@octos4murai Please sign CLA. Without this we can not merge the PR.

@ghost
Copy link
Author

ghost commented Jun 12, 2021

@octos4murai Please sign CLA. Without this we can not merge the PR.

Done. Thanks for the reminder.

Copy link
Collaborator

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example changes are much needed, thanks!

The parameter name changes we can't take, and I don't think the terminology changes add clarity here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually more than strict cmdlets can be used here. The path to a script will work as well, for example

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An overload for this method refers to cmdlet in its XML comments summary. Its parameter is also named cmdlet but as you mentioned elsewhere, this would be a breaking change.

Do you suggest to:

  • Keep this the same and change the overload method's XML comments to also use command to connote that more than strict cmdlets can be used, or
  • Allow the apparent inconsistency and make no changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its parameter is also named cmdlet but as you mentioned elsewhere, this would be a breaking change.

Yes, it's an unfortunate inconsistency, but one that we must now live with. The parameter name is part of the API.

Feel free to add any extra documentation around the XML, but the parameter names themselves can't be changed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. I will exclude this breaking change.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Jun 14, 2021
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rjmholt I think there is a bug here where a potential null argument is referred to using string "cmdlet". The actual argument name is not "cmdlet" but rather "command". If you agree, perhaps I can replace this line with:

throw PSTraceSource.NewArgumentNullException(nameof(command));

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pull new PR with the change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pull new PR with the change.

Just would like some clarification -- should I create a new GitHub issue and then create a new PR linked to that issue?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues are need only for discussions to understand what we should do or not do. Here we see simple inconsistency and can accept new PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues are need only for discussions to understand what we should do or not do. Here we see simple inconsistency and can accept new PR.

Got it. Thank you.

@ghost ghost requested a review from rjmholt June 15, 2021 06:44
@rjmholt rjmholt merged commit 7b933d0 into PowerShell:master Jun 15, 2021
@ghost ghost deleted the fix-pscommand-xml-comments branch June 15, 2021 16:42
@ghost
Copy link

ghost commented Jun 17, 2021

🎉v7.2.0-preview.7 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc Bug in AddScript API

3 participants