Closed PrzemyslawKlys closed 2 years ago
Hi @PrzemyslawKlys, if you run PSScriptAnalyzer on this directly, do you get an error?
There should be an explanation of how to do that in our script analysis bug template.
PS C:\Support\GitHub\PSBlackListChecker\Ignore> Invoke-ScriptAnalyzer -Path '.\Evotec-RunMeReporting.ps1' -verbose -Settings PSGallery -Recurse
VERBOSE: Using settings file at C:\Users\pklys\.vscode\extensions\ms-vscode.powershell-1.9.0\modules\PSScriptAnalyzer\1.17.1\Settings\PSGallery.psd1.
VERBOSE: Performing the operation "Analyzing path with Recurse=True" on target "C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1".
VERBOSE: Performing the operation "Analyzing file C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1" on target "C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1".
VERBOSE: Analyzing file: C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1
VERBOSE: Running PSAvoidUsingCmdletAliases rule.
VERBOSE: Running PSAvoidDefaultValueSwitchParameter rule.
VERBOSE: Running PSAvoidUsingEmptyCatchBlock rule.
VERBOSE: Running PSAvoidGlobalVars rule.
VERBOSE: Running PSAvoidUsingPositionalParameters rule.
VERBOSE: Running PSReservedCmdletChar rule.
VERBOSE: Running PSReservedParams rule.
VERBOSE: Running PSAvoidUsingComputerNameHardcoded rule.
VERBOSE: Running PSAvoidUsingConvertToSecureStringWithPlainText rule.
VERBOSE: Running PSAvoidUsingUserNameAndPassWordParams rule.
VERBOSE: Running PSAvoidUsingInvokeExpression rule.
VERBOSE: Running PSAvoidUsingPlainTextForPassword rule.
VERBOSE: Running PSMissingModuleManifestField rule.
VERBOSE: Running PSAvoidUsingWMICmdlet rule.
VERBOSE: Running PSUseApprovedVerbs rule.
VERBOSE: Running PSUseCmdletCorrectly rule.
VERBOSE: Running PSUseDeclaredVarsMoreThanAssignments rule.
VERBOSE: Running PSUsePSCredentialType rule.
VERBOSE: Running PSUseShouldProcessForStateChangingFunctions rule.
VERBOSE: Running PSShouldProcess rule.
VERBOSE: Running PSUseSingularNouns rule.
or
PS C:\Support\GitHub\PSBlackListChecker\Ignore> Invoke-ScriptAnalyzer -Path '.\Evotec-RunMeReporting.ps1' -verbose
VERBOSE: Settings object could not be resolved.
VERBOSE: Performing the operation "Analyzing path with Recurse=False" on target "C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1".
VERBOSE: Performing the operation "Analyzing file C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1" on target "C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1".
VERBOSE: Analyzing file: C:\Support\GitHub\PSBlackListChecker\Ignore\Evotec-RunMeReporting.ps1
VERBOSE: Running PSAvoidDefaultValueForMandatoryParameter rule.
VERBOSE: Running PSAvoidDefaultValueSwitchParameter rule.
VERBOSE: Running PSAvoidUsingCmdletAliases rule.
VERBOSE: Running PSAvoidAssignmentToAutomaticVariable rule.
VERBOSE: Running PSAvoidGlobalAliases rule.
VERBOSE: Running PSAvoidGlobalFunctions rule.
VERBOSE: Running PSAvoidUsingEmptyCatchBlock rule.
VERBOSE: Running PSAvoidInvokingEmptyMembers rule.
VERBOSE: Running PSAvoidNullOrEmptyHelpMessageAttribute rule.
VERBOSE: Running PSReservedParams rule.
VERBOSE: Running PSAvoidGlobalVars rule.
VERBOSE: Running PSAvoidShouldContinueWithoutForce rule.
VERBOSE: Running PSAvoidUsingPositionalParameters rule.
VERBOSE: Running PSAvoidUsingUserNameAndPassWordParams rule.
VERBOSE: Running PSAvoidUsingConvertToSecureStringWithPlainText rule.
VERBOSE: Running PSAvoidUsingDeprecatedManifestFields rule.
VERBOSE: Running PSAvoidUsingInvokeExpression rule.
VERBOSE: Running PSAvoidUsingWriteHost rule.
VERBOSE: Running PSAvoidUsingWMICmdlet rule.
VERBOSE: Running PSPossibleIncorrectComparisonWithNull rule.
VERBOSE: Running PSPossibleIncorrectUsageOfAssignmentOperator rule.
VERBOSE: Running PSAvoidUsingPlainTextForPassword rule.
VERBOSE: Running PSAvoidUsingComputerNameHardcoded rule.
VERBOSE: Running PSMissingModuleManifestField rule.
VERBOSE: Running PSPossibleIncorrectUsageOfRedirectionOperator rule.
VERBOSE: Running PSReservedCmdletChar rule.
VERBOSE: Running PSProvideCommentHelp rule.
VERBOSE: Running PSUseCmdletCorrectly rule.
VERBOSE: Running PSUseCompatibleCmdlets rule.
VERBOSE: Running PSUseLiteralInitializerForHashtable rule.
VERBOSE: Running PSUseOutputTypeCorrectly rule.
VERBOSE: Running PSUsePSCredentialType rule.
VERBOSE: Running PSUseDeclaredVarsMoreThanAssignments rule.
VERBOSE: Running PSUseShouldProcessForStateChangingFunctions rule.
VERBOSE: Running PSUseSupportsShouldProcess rule.
VERBOSE: Running PSUseSingularNouns rule.
VERBOSE: Running PSUseBOMForUnicodeEncodedFile rule.
VERBOSE: Running PSUseUTF8EncodingForHelpFile rule.
VERBOSE: Running PSUseToExportFieldsInManifest rule.
VERBOSE: Running PSShouldProcess rule.
VERBOSE: Running PSUseApprovedVerbs rule.
VERBOSE: Running PSMisleadingBacktick rule.
VERBOSE: Running PSAvoidTrailingWhitespace rule.
Although I've never run this manually so not sure what to expect as an output.
PS C:\Support\GitHub\PSBlackListChecker> get-module psdshook -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.1.5 PSDsHook Invoke-PSDsHook
Hmmm looks like this might be on us. A using module
problem is a parse-time error, so it will be reported by the parser and PSES deals with that.
I imagine what's happening is that parsing the script in memory in PSES doesn't find the module the way that executing the file does. We should look into it.
I think it works correctly now.
System Details
System Details Output
Issue Description
I am using PSDsHook module. It's installed from PSGallery. It works fine. I use it as Import-Module and it doesn't bug out. I change it to
using module PSDsHook
and it works fine. However for VSCode it's a problem. It says module can't be found.Since PSDsHook uses Classes it requires
using module
instead of standard Import-Module.Expected Behaviour
Not marking everything red.
Actual Behaviour
Marking file on left as red, claiming it's an error.
Attached Logs
Follow the instructions in the troubleshooting docs about capturing and sending logs.