1

Closed

Unapproved Verbs Used - should be fixed

description

There are two cmdlets/functiosn with unapproved verb names:

Decode-SQLName
Encode-SQLName

To see this, after loading SQLPS, do this from a PowerShell prompt:

Import-Modue SQLPS -Verbose -Force

IMHO, community modules, like this one, really need to follow things like approved verbs and not expect users to have to 'ignore errors'. The commuynity can, and should, do better.
Closed Jan 30 at 3:31 AM by MikeShepard
The cmdlets mentioned are in SQLPS, not SQLPSX.

comments

MikeShepard wrote Sep 10, 2013 at 10:16 PM

I agree with you on this. A challenge is that once the code has been released with the unapproved verbs, you don't want to break everything by renaming the function.

One thing we can do (and I will recommend to the team) is that after renaming the offending functions, create an alias with the old unapproved name.

for instance, replace this:
function bad-function {
}

with this:
function get-badfunction {
}
new-alias -name bad-function -value get-badfunction

tfl wrote Sep 11, 2013 at 2:34 PM

The fix is easy.
  1. Write the code using only approved verb. This means the actual cmdlet/function name would be changed.
  2. Ship an alias with the module that aliases the old (bad) name to the new (good) name.
That way the module imports fine, best practice in cmdlet naming is adhered to and legacy is preserved

MikeShepard wrote Sep 11, 2013 at 4:31 PM

Isn't that what I said?

MikeShepard wrote Sep 19, 2013 at 1:25 AM

One other thing to note, which may or may not be important. This project is SQLPSX (SQL PowerShell Extensions), not SQLPS (SQL PowerShell). SQLPS is part of the SQL Server installation that comes from Microsoft. I haven't gone through the modules in SQLPSX recently to look for improper verbs, but I wouldn't be surprised to find some.

The 2 functions you mentioned above, Decode-SQLName and Encode-SQLName are included in SQLPS.