Title: The rule 'PSUseCmdletCorrectly' reference a wrong command · Issue #755 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: The rule 'PSUseCmdletCorrectly' reference a wrong command · Issue #755 · PowerShell/PSScriptAnalyzer
X Title: The rule 'PSUseCmdletCorrectly' reference a wrong command · Issue #755 · PowerShell/PSScriptAnalyzer
Description: The analysis of this code seems to reference a command that is not in the current scope : #Requires -Modules PSCX $code=@' function Convert-Object{ [CmdletBinding()] [OutputType([String])] Param ( [Parameter(Mandatory=$true)] $InputObjec...
Open Graph Description: The analysis of this code seems to reference a command that is not in the current scope : #Requires -Modules PSCX $code=@' function Convert-Object{ [CmdletBinding()] [OutputType([String])] Param ( ...
X Description: The analysis of this code seems to reference a command that is not in the current scope : #Requires -Modules PSCX $code=@' function Convert-Object{ [CmdletBinding()] [OutputType([String])] Para...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/755
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The rule 'PSUseCmdletCorrectly' reference a wrong command","articleBody":"The analysis of this code seems to reference a command that is not in the current scope :\r\n```Powershell\r\n\r\n#Requires -Modules PSCX\r\n\r\n$code=@'\r\nfunction Convert-Object{\r\n [CmdletBinding()]\r\n [OutputType([String])]\r\n Param\r\n (\r\n [Parameter(Mandatory=$true)]\r\n $InputObject\r\n )\r\n\r\n function Get-TypeName {\r\n param()\r\n $InputObject.pstypenames[0] -Replace '^Selected\\.',''\r\n }\r\n\r\n function MethodHeader {\r\n param()\r\n $type=Get-TypeName\r\n return $type\r\n }\r\n MethodHeader\r\n}#Convert-Object\r\n'@\r\n\r\nInvoke-ScriptAnalyzer -ScriptDefinition $code\r\n# RuleName Severity ScriptName Line Message\r\n# -------- -------- ---------- ---- -------\r\n# PSUseCmdletCorrectly Warning 18 Cmdlet 'Get-TypeName' may be used incorrectly.\r\n# Please check that all mandatory parameters are\r\n# supplied.\r\n\r\n\r\ngcm Get-TypeName\r\n# CommandType Name Version Source\r\n# ----------- ---- ------- ------\r\n# Cmdlet Get-TypeName 3.2.0.0 Pscx\r\n\r\nRemove-module pscx\r\nInvoke-ScriptAnalyzer -ScriptDefinition $code\r\n#same warning\r\n\r\n#close the PS session\r\n#move 'C:\\Program Files (x86)\\PowerShell Community Extensions' to 'C:\\temp'\r\n\r\n#new PS Session -NoProfile\r\n$code=@'\r\nfunction Convert-Object{\r\n [CmdletBinding()]\r\n [OutputType([String])]\r\n Param\r\n (\r\n [Parameter(Mandatory=$true)]\r\n $InputObject\r\n )\r\n\r\n function Get-TypeName {\r\n param()\r\n $InputObject.pstypenames[0] -Replace '^Selected\\.',''\r\n }\r\n\r\n function MethodHeader {\r\n param()\r\n $type=Get-TypeName\r\n return $type\r\n }\r\n MethodHeader\r\n}#Convert-Object\r\n'@\r\nInvoke-ScriptAnalyzer -ScriptDefinition $code\r\n#Ok, no PSSA Warning\r\n\r\n$Env:Path -split ';'\r\n# %SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\\r\n# C:\\ProgramData\\Oracle\\Java\\javapath\r\n# C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live\r\n# C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live\r\n# C:\\Windows\\system32\r\n# C:\\Windows\r\n# C:\\Windows\\System32\\Wbem\r\n# C:\\Program Files (x86)\\WinMerge\r\n# c:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\\r\n# c:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\\r\n# c:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\\r\n# C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static\r\n# C:\\Program Files (x86)\\Microsoft Team Foundation Server 2012 Power Tools\\Best Practices Analyzer\\\r\n# C:\\Program Files (x86)\\Microsoft Team Foundation Server 2012 Power Tools\\\r\n# C:\\Program Files (x86)\\Windows Live\\Shared\r\n# C:\\Program Files\\Microsoft\\Web Platform Installer\\\r\n# C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\\r\n# C:\\Program Files\\Windows Fabric\\bin\\Fabric\\Fabric.Code.1.0\r\n# C:\\Program Files\\SourceGear\\Common\\DiffMerge\\\r\n# C:\\Program Files (x86)\\Disconnect\\Disconnect Desktop\\openvpn\\bin\r\n# C:\\Program Files (x86)\\Git\\cmd\r\n# C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\Modules\\TShell\\TShell\\\r\n# C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\\r\n# C:\\Program Files\\Git\\cmd\r\n# C:\\ProgramData\\chocolatey\\bin\r\n# C:\\Program Files\\WindowsPowerShell\\Scripts\r\n# C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\\r\n# C:\\Program Files\\TortoiseGit\\bin\r\n# C:\\Program Files\\dotnet\\\r\n# C:\\Users\\Laurent\\AppData\\Local\\atom\\bin\r\n# C:\\Program Files (x86)\\Microsoft VS Code\\bin\r\n# C:\\Dev\\NuGet\r\n# C:\\Users\\Laurent\\Documents\\WindowsPowerShell\\Scripts\r\n# C:\\Program Files (x86)\\PowerShell Community Extensions\\Pscx3\\Pscx\\Apps\r\n\r\n$env:PSmodulePath -split ';'\r\n# C:\\Users\\Laurent\\Documents\\WindowsPowerShell\\Modules\\\r\n# C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\\r\n# C:\\Program Files (x86)\\PowerShell Community Extensions\\Pscx3\\\r\n# C:\\Program Files\\Service Bus\\1.0\\\r\n# C:\\Program Files\\Workflow Manager\\1.0\\\r\n# C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\PowerShell\\ServiceManagement\r\n# C:\\Program Files\\WindowsPowerShell\\Modules\r\n```\r\nVersions :\r\n```Powershell\r\n$PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 5.1.14409.1005\r\nPSEdition Desktop\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14409.1005}\r\nBuildVersion 10.0.14409.1005\r\nCLRVersion 4.0.30319.42000\r\nWSManStackVersion 3.0\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\n```\r\n\r\nPSScriptAnalyzer version 1.11.1 \r\nWindows Seven x64","author":{"url":"https://github.com/LaurentDardenne","@type":"Person","name":"LaurentDardenne"},"datePublished":"2017-04-28T18:14:50Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/755"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dd891850-21f8-1a3a-8ef4-ec2763dbf309 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E0DA:55614:14123A:1A8647:6AFCFE8B |
| html-safe-nonce | 9a57941b01a16a0a42d8d08109d8a46681f4cd4452ae4540eedab656e54c1fa8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMERBOjU1NjE0OjE0MTIzQToxQTg2NDc6NkFGQ0ZFOEIiLCJ2aXNpdG9yX2lkIjoiNjUxNjI3Mjg1MjI2ODU0NzcyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2884136004cc4ed6e7daaac2c0c235b10b67c2bfb7ab86793038c38ca89b48bb |
| hovercard-subject-tag | issue:225154706 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PSScriptAnalyzer/755/issue_layout |
| twitter:image | https://opengraph.githubassets.com/604ad30a4e33570000ac4b2a021124a29f7def955055c993e7f971ad04b0c1ae/PowerShell/PSScriptAnalyzer/issues/755 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/604ad30a4e33570000ac4b2a021124a29f7def955055c993e7f971ad04b0c1ae/PowerShell/PSScriptAnalyzer/issues/755 |
| og:image:alt | The analysis of this code seems to reference a command that is not in the current scope : #Requires -Modules PSCX $code=@' function Convert-Object{ [CmdletBinding()] [OutputType([String])] Param ( ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LaurentDardenne |
| hostname | github.com |
| expected-hostname | github.com |
| None | cfabad6ee26d2b84c7afef4ae0cc71b8b692fb9d66f9f15997652ef991bfd3f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 33149177 |
| octolytics-dimension-repository_nwo | PowerShell/PSScriptAnalyzer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 33149177 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PSScriptAnalyzer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 35f85b78676038389558a41adf8d76e474592ede |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width