Skip to content

Code Review #30

Open
Open

Description

@iainbrighton

Before publishing to the gallery, we need to perform a code review. This should (at a minimum) cover:

  • Running the PSScriptAnalyzer
    • Ignoring the pesky 'PSProvideDefaultParameterValue' rule!
    • A quick run shows no errors, but a few warnings (excluding the above rule)!
  • Check that ShouldProcess is implemented where necessary
    • Highlighting where you think -WhatIf and/or -Confirm should if necessary would be valuable
  • Check that pipeline input is accepted
    • Pipeline support should be in place for all publicly exposed cmdlets

Activity

  1. csandfeld commented on Nov 27, 2015

    @csandfeld
    Contributor

    Not sure my skills are adequite, but will be happy to help. Just let me know what part you would like me to check, and I'll do my best.

  2. iainbrighton commented on Dec 1, 2015

    @iainbrighton
    ContributorAuthor

    I'm sure you'll be great! Looking through the code and where you don't understand what/why something is happening will mean I need to add addition comments. If this is going to turn into a community effort, everyone needs to understand what's going on before they can join in!

  3. DexterPOSH commented on Dec 2, 2015

    @DexterPOSH
    Contributor

    @iainbrighton @csandfeld I am going through the Code in order to learn the approach you have used here. I would like to pitch in for this effort.

  4. iainbrighton commented on Dec 2, 2015

    @iainbrighton
    ContributorAuthor

    @DexterPOSH Welcome on board! If anything matches the above criteria etc, put a #TODO , a brief comment and send a PR 😄

  5. DexterPOSH commented on Dec 3, 2015

    @DexterPOSH
    Contributor

    @iainbrighton I will do that. Also will try to put in how it works based on my understanding, you can later enhance it.

  6. csandfeld commented on Dec 4, 2015

    @csandfeld
    Contributor

    OK, I will jump in on a "best effort" basis :)

  7. csandfeld commented on Dec 11, 2015

    @csandfeld
    Contributor

    @iainbrighton The Script Analyzer rule 'PSUseSingularNouns' deals with function names, not following the the 'singular noun' best practice.

    In this project it throws a warning about the *-LabHostDefaults and *-LabVMDefaults functions. I can start changing them to singular nouns, but wanted to run that by you before I go down that route. What's your take on it?

  8. csandfeld commented on Dec 11, 2015

    @csandfeld
    Contributor

    @iainbrighton The Script Analyzer rule 'PSMissingModuleManifestField' complains about a missing missing module version field in the manifest:

    • .\en-US\CustomMedia.psd1
    • .\en-US\CustomResource.psd1
    • .\en-US\Example.psd1
    • .\Resources.psd1

    What's your take on that warning? Can it be ignored (as a module version has no relevance in these files), or should we add a field to make the script analyzer happy?

  9. iainbrighton commented on Dec 11, 2015

    @iainbrighton
    ContributorAuthor

    This sounds like it needs to filed as an issue on the PSScriptAnalyzer GitHub page. The script analyzer is assuming that all .psd1 files are module manifests when they’re just PowerShell “data files”. The most common usage is manifests, but Import-LocalizedData requires their usage too and that’s being flagged. Therefore, I think this is a bug?

  10. iainbrighton commented on Dec 11, 2015

    @iainbrighton
    ContributorAuthor

    I have no problem with renaming them to singular nouns. If we add an alias then we won’t break anything – other than the tests?!

  11. ryanspletzer commented on Feb 16, 2016

    @ryanspletzer
    Contributor

    @iainbrighton I've been reviewing the codebase over at at fork of Dev:

    https://github.com/ryanspletzer/Lability

    Did some basic cleanup / typo fix commits.

    Is there a reason that xHyper-V and xPendingReboot are bundled with the repo vs. being pulled in separately from PowerShell gallery?

  12. DexterPOSH commented on Feb 16, 2016

    @DexterPOSH
    Contributor

    @ryanspletzer
    From what I see xPendingReboot is the DSC resource needed for the host configuration done via Start-LabHostConfiguration (bare bone requirement).

    And xHyper-V DSC resource is needed to provision the VMs.
    These are the bare minimum DSC resources needed for the config, maybe that piece can be automated too.

  13. iainbrighton commented on Feb 16, 2016

    @iainbrighton
    ContributorAuthor

    @ryanspletzer Thanks for the contribution! I'm not sure all the formatting changes are necessary, but the typos are definitely gratefully received. Send the PR and we can discuss.

    As for the bundled modules, they are only used internally to configure the host, virtual switches and VMs. They were originally external to the module. They have been moved internally for two main reasons:

    1. To avoid conflicts with locally installed DSC resource versions. We don't want to enforce a particular version of the xHyper-V or xPendingReboot modules upon anyone.
    2. Bugs fixes and new functionality is easier to add. The fixes/additions are pushed upstream to the public repositories, but it can take months to get changes merged in and made available in the PSGallery.
  14. iainbrighton commented on Feb 16, 2016

    @iainbrighton
    ContributorAuthor

    @ryanspletzer Whilst we're on the subject of documentation.. As you've probably read through most of the documentation, have you noticed any glaring omissions that need to be added?

  15. 12 remaining items

  16. csandfeld commented on Apr 3, 2016

    @csandfeld
    Contributor

    Unrelated to the above, but have been wondering for some time now. Some code is placed in the 'Src' folder, while other code is placed in the 'Lib' folder. What criteria dictates where code is placed?

  17. csandfeld commented on Apr 3, 2016

    @csandfeld
    Contributor

    I have started adding ShouldProcess support to Remove-LabConfiguration and the called sub-cmdlets. When done I would like you to review the changes before I move on.

  18. iainbrighton commented on Apr 3, 2016

    @iainbrighton
    ContributorAuthor
  19. iainbrighton commented on Apr 3, 2016

    @iainbrighton
    ContributorAuthor
  20. csandfeld commented on Apr 3, 2016

    @csandfeld
    Contributor

    Been working a bit on ShouldProcess for Remove-LabConfiguration and sub Cmdets today. Not all done yet (need to set -Confirm:$false here and there), but when you get a couple of minutes @iainbrighton, could you look through 64325ec and see if I am on the right path here?

  21. iainbrighton commented on Apr 4, 2016

    @iainbrighton
    ContributorAuthor
  22. ryanspletzer commented on Apr 20, 2016

    @ryanspletzer
    Contributor

    More of a style thing -- I noticed in certain places [string] is used where in other places the full [System.String] is used. Other examples are [System.Management.Automation.SwitchParameter] which is used largely instead of [switch].

    Is the preference in this module to use the fully qualified type names wherever possible?

  23. iainbrighton commented on Apr 24, 2016

    @iainbrighton
    ContributorAuthor

    Hi @ryanspletzer - I do tend to fully qualify everything, as we can never be too explicit and it's a C# habit (just like the semicolons). That's not to say that I wouldn't accept a PR that isn't fully qualified or missing semi-colons!

  24. ryanspletzer commented on Jul 13, 2016

    @ryanspletzer
    Contributor

    Can I ask another lame question? Line 130 in TestLabGuide.ps1, what is that commented out #Router = '10.0.0.2'; all about?

    Even xDhcpServer doesn't have this Router parameter documented well, and I let them know about it.

  25. iainbrighton commented on Jul 13, 2016

    @iainbrighton
    ContributorAuthor

    @ryanspletzer Erm - I'm not entirely sure! It could be because the default gateway didn't work in my lab environment or (judging by dsccommunity/DhcpServerDsc#26) it might be because it didn't work. However, if it was the latter, I'm surprised I either didn't log an issue or fix it.. Not particularly helpful, I know 😞

  26. brycem commented on Sep 16, 2016

    @brycem

    @iainbrighton - Unless I uncomment that router parameter, I was having xDhcpServer config fail (OS 2016 Server Standard) - Sorry, didn't capture the failure from the failed run.

  27. iainbrighton commented on Sep 16, 2016

    @iainbrighton
    ContributorAuthor

    @brycem Yeah - a xDhcpServer DSC resource update broke that. It was fixed, but seems that it's crept back into the latter xDhcpServer releases..

  28. DevOpsBoondoggles commented on Sep 3, 2017

    @DevOpsBoondoggles

    Not sure you still need help but I spent some time on a testlab set of scripting before finding your one which is WAAAY better.
    Am not great but happy to help

  29. MikeShepard commented on Jul 15, 2018

    @MikeShepard

    I just noticed that Get-WindowsImageByIndex and Get-WindowsImageByName are switched in the ps1 files (i.e. ByIndex is in ByName.ps1 and vice versa).

    Not a big deal, but it did confuse me for a bit.

  30. iainbrighton commented on Jul 17, 2018

    @iainbrighton
    ContributorAuthor

    @MikeShepard Good spot! I'll get that corrected..

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions