question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deprecate the -DisableNameChecking parameter, and remove the warnings that are produced if that parameter is not used

See original GitHub issue

I am logging this as a bug and not as an enhancement request because in the eyes of a tool builder, this appears to be a bug (or at the very least, a design flaw). The warning that is produced upon import of a module that contains a command with an unapproved verb is for nobody other than the author of that module, yet scripters are the ones who are presented with that message. This poses several problems:

  1. It confuses scripters who don’t realize that message is not meant for them unless they also created the module.
  2. It pushes work on toolbuilders to silence this warning if they happen to be using PowerShell behind the scenes and modules they use (that often are beyond their control) happen to cause this warning.

The message that is being conveyed is of good intent, but it is directed at the wrong audience entirely, and it should never have been written as a warning for all to see (warnings are meant to convey useful information to the scripter that they may be doing something wrong). For that reason, the message should be removed entirely from Import-Module and Import-PSSession. The -DisableNameChecking parameter can be kept around for compatibility reasons, but it should simply be ignored. PSScriptAnalyzer is a much more appropriate technology to be used to convey this information to the author of a command.

Steps to reproduce

nmo -name Example {
    function Create-Something {[CmdletBinding()]param(); Write-Verbose 'This could create something big!'}
} | ipmo

Expected behavior

The module would import, without any messages sent to the console.

Actual behavior

The module imports, sending the following output to the console:

WARNING: The names of some imported commands from the module 'Example' include unapproved verbs that might make them
less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose
parameter. For a list of approved verbs, type Get-Verb.

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
rkeithhillcommented, Sep 16, 2020

I could see adding this sort of a check to Publish-Module but having it in Import-Module is a real drag.

3reactions
jhoneillcommented, Sep 28, 2020

Imagine <snip> you are presented with a warning (or possibly multiple warnings) about cmdlets that you didn’t invoke and weren’t going to invoke.

Any self respecting developer would fix this before they let their code out into the world. So the first think you think is “They didn’t test this, what dreadful shoddy code have I got here ?” Run an anti-malware scan and delete it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent "parameter PLSQL_DEBUG is deprecated ...
1 Answer 1 ... To disable the warning for your session the usage is: ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL','DISABLE:06015';. However this ...
Read more >
about Modules - PowerShell
To suppress the warning message, use the DisableNameChecking parameter of the Import-Module cmdlet. Built-in Modules and Snap-ins. In PowerShell ...
Read more >
ORA-32004: obsolete and/or deprecated parameter(s) specified
Hi Tom, When starting the database, I get the error ORA-32004: --------------------------------- SQL> startup. ORA-32004: obsolete and/or deprecated ...
Read more >
dbms_warning usage tips
You can selectively enable and disable these warnings through the PLSQL_WARNINGS initialization parameter and the DBMS_WARNING package."
Read more >
Oracle | PL/SQL Warnings - Morgan's Library
A BULK COLLECT clause was specified in a cursor declaration. The default expression of a formal parameter referred to another formal parameter from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found