Skip to content

Conversation

@vexx32
Copy link
Collaborator

@vexx32 vexx32 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

/// to percolate up to the caller of ProcessRecord etc.
/// </exception>
internal void _WriteObjectsSkipAllowCheck(object sendToPipeline)
internal void _EnumerateAndWriteObjectSkipAllowCheck(object sendToPipeline)
Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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 added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Mar 6, 2019
@iSazonov iSazonov self-assigned this Mar 8, 2019
@iSazonov iSazonov merged commit b23e835 into PowerShell:master Mar 8, 2019
@vexx32 vexx32 deleted the RenameWriteObjects branch March 8, 2019 14:29
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.

2 participants