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

Rename private methods in MshCommandRuntime.cs #9074

Merged
merged 1 commit into from Mar 8, 2019

Conversation

@vexx32
Copy link
Contributor

commented Mar 6, 2019

PR Summary

Renamed methods to avoid confusion when examining and maintaining core runtime code.

  • DoWriteObjects() -> DoWriteEnumeratedObject()
    • This was almost identical in name to the distinct DoWriteObject() (no s) method.
  • _WriteObjectsSkipAllowCheck() -> _EnumerateAndWriteObjectSkipAllowCheck()
    • Again, almost identical in name to _WriteObjectSkipAllowCheck()

This pair of methods is not actually referenced outside MshCommandRuntime.cs, and only in one or two places; I consider renaming it to be of no risk whatsoever as it is a private method.

There are no functional modifications, just renaming these before someone digs a little too deep here and breaks it by accident due to the very confusing naming scheme.

PR Context

As I was debugging #5955 I noticed that there are two pairs of commands in MshCommandRuntime.cs that deal with writing objects, one set which permits enumerating collections, the other which does not.

These are named far too similarly, where a mere typo could cause the wrong one to be used if this code is ever updated.

PR Checklist

@vexx32 vexx32 requested review from BrucePay and daxian-dbw as code owners Mar 6, 2019

@vexx32 vexx32 referenced this pull request Mar 6, 2019
4 of 11 tasks complete
@@ -2591,7 +2591,7 @@ internal void _WriteObjectSkipAllowCheck(object sendToPipeline)
/// The Cmdlet should generally just allow PipelineStoppedException
/// to percolate up to the caller of ProcessRecord etc.
/// </exception>
internal void _WriteObjectsSkipAllowCheck(object sendToPipeline)
internal void _EnumerateAndWriteObjectSkipAllowCheck(object sendToPipeline)

This comment has been minimized.

Copy link
@iSazonov

iSazonov Mar 6, 2019

Collaborator
Suggested change
internal void _EnumerateAndWriteObjectSkipAllowCheck(object sendToPipeline)
internal void EnumerateAndWriteObjectSkipAllowCheck(object sendToPipeline)

This comment has been minimized.

Copy link
@vexx32

vexx32 Mar 6, 2019

Author Contributor

If I go that route it might be better to just rename half the things in this file, in all honesty... There are a lot of similarly questionable names here.

This comment has been minimized.

Copy link
@iSazonov

iSazonov Mar 6, 2019

Collaborator

Oh, no. It is better to spend time to create something useful.

This comment has been minimized.

Copy link
@vexx32

vexx32 Mar 6, 2019

Author Contributor

I'll come back to it when I'm really bored and do a proper style pass over the whole thing. 😉

Not a big-ticket item, but there's a lot of room for tidying up in this one. 😄

@iSazonov iSazonov self-assigned this Mar 8, 2019

@iSazonov iSazonov merged commit b23e835 into PowerShell:master Mar 8, 2019

6 of 7 checks passed

CodeFactor 7 issues fixed. 25 issues found.
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
PowerShell-CI-linux #PR-9074-20190306.01 succeeded
Details
PowerShell-CI-macos #PR-9074-20190306.01 succeeded
Details
PowerShell-CI-windows #PR-9074-20190306.01 succeeded
Details
WIP Ready for review
Details
license/cla All CLA requirements met.

@vexx32 vexx32 deleted the vexx32:RenameWriteObjects branch Mar 8, 2019

RDIL pushed a commit to RDIL/PowerShell that referenced this pull request Mar 13, 2019

Rename private methods in MshCommandRuntime.cs (PowerShell#9074)
* DoWriteObjects() -> DoWriteEnumeratedObject()
* _WriteObjectsSkipAllowCheck() -> _EnumerateAndWriteObjectSkipAllowCheck()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.