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

chef.psm1 PowerShell Module uses unapproved verbs #8525

Open
johnmccrae opened this issue Apr 19, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@johnmccrae
Copy link

commented Apr 19, 2019

The Chef powershell module uses unapproved verbs for naming functions and should be updated to reflect proper coding techniques.

Current -> Suggested
Run-RubyCommand -> Invoke-RubyCommand
Run-ExecutableAndWait -> Invoke-ExecutableAndWait
Load-WIn32Bindings -> Initialize-WIn32Bindings

The win32 Kernel code at the top could be refactored following the example at the end of this page to make it more readable. https://www.raydbg.com/2017/Call-Native-Win32-API-in-PowerShell/

Motivation

As a software developer,
I want to have confidence in Chef software because it uses current coding standards,
so that I can trust their products and more confidently use them and talk them up to my peers.

Specification

1 - rename the functions to the suggested or to a compatible verb-noun format
2 - refactor the win32 binding to be more readable.

Attached is the suggested changes already made. I included help tips and got rid of extra whitespace as well.

chef-suggested.psm1.txt

Downstream Impact

Any hard-coded references to the functions will be impacted. However, since only the chef* functions are actually exported for use by the end-user, the impact should be minimal.

@jonsmorrow

This comment has been minimized.

Copy link
Member

commented May 13, 2019

@johnmccrae Thanks for catching this. It's actually in chef core so I'm going to move the issue there.

@jonsmorrow jonsmorrow transferred this issue from chef/chef-workstation May 13, 2019

@tas50

This comment has been minimized.

Copy link
Member

commented May 13, 2019

@johnmccrae can you open a PR to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.