René's URL Explorer Experiment


Title: Function-Based Custom Rule with "Error" Severity Doesn’t Show Under -Severity Error · Issue #2049 · PowerShell/PSScriptAnalyzer · GitHub

Open Graph Title: Function-Based Custom Rule with "Error" Severity Doesn’t Show Under -Severity Error · Issue #2049 · PowerShell/PSScriptAnalyzer

X Title: Function-Based Custom Rule with "Error" Severity Doesn’t Show Under -Severity Error · Issue #2049 · PowerShell/PSScriptAnalyzer

Description: I'm experiencing an issue with function-based custom rules. When a custom rule returns a severity of Error, the results don't appear under the -Severity Error filter. Instead, they show up only when filtering by warnings or when no filte...

Open Graph Description: I'm experiencing an issue with function-based custom rules. When a custom rule returns a severity of Error, the results don't appear under the -Severity Error filter. Instead, they show up only whe...

X Description: I'm experiencing an issue with function-based custom rules. When a custom rule returns a severity of Error, the results don't appear under the -Severity Error filter. Instead, they show up ...

Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/2049

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Function-Based Custom Rule with \"Error\" Severity Doesn’t Show Under -Severity Error","articleBody":"I'm experiencing an issue with function-based custom rules. When a custom rule returns a severity of `Error`, the results don't appear under the `-Severity Error` filter. Instead, they show up only when filtering by warnings or when no filter is applied.\r\n\r\nI couldn’t find any other reports of a similar issue. The closest I came across was [#1237](https://github.com/PowerShell/PSScriptAnalyzer/issues/1237), but it seems unanswered or possibly overlooked.\r\n\r\nThe use-case here is for demonstration purposes.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\nCustom Rule (Measure-AvoidCustomInvokeExpression.psm1)\r\n```PowerShell\r\nfunction Measure-AvoidCustomInvokeExpression {\r\n    [CmdletBinding()]\r\n    [OutputType([Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord[]])]\r\n    param (\r\n        [Parameter(Mandatory = $true)]\r\n        [ValidateNotNullOrEmpty()]\r\n        [System.Management.Automation.Language.ScriptBlockAst] $ScriptBlockAst\r\n    )\r\n    process {\r\n        $results = @()\r\n        \r\n        try {\r\n            [ScriptBlock]$predicate = {\r\n                param (\r\n                    [System.Management.Automation.Language.Ast] $Ast\r\n                )\r\n                [bool]$returnValue = $false\r\n                \r\n                if ($Ast -is [System.Management.Automation.Language.CommandAst]) {\r\n                    [System.Management.Automation.Language.CommandAst]$commandAst = $Ast\r\n                    if ($commandAst.GetCommandName() -eq 'Invoke-Expression') {\r\n                        $returnValue = $true\r\n                    }\r\n                }\r\n                return $returnValue\r\n            }\r\n            \r\n            [System.Management.Automation.Language.Ast[]]$asts = $ScriptBlockAst.FindAll($predicate, $true)\r\n            if ($asts.Count -ne 0) {\r\n                foreach ($ast in $asts) {\r\n                    $result = New-Object `\r\n                        -TypeName \"Microsoft.Windows.Powershell.ScriptAnalyzer.Generic.DiagnosticRecord\" `\r\n                        -ArgumentList `\r\n                        \"Stop it!\", \r\n                        $ast.Extent, \r\n                        \"AvoidCustomInvokeExpression\", \r\n                        Error, \r\n                        $null\r\n                    \r\n                    $results += $result\r\n                }\r\n            }\r\n            return $results\r\n        }\r\n        catch {\r\n            $PSCmdlet.ThrowTerminatingError($PSItem)\r\n        }\r\n    }\r\n}\r\n\r\nExport-ModuleMember -Function Measure-AvoidCustomInvokeExpression\r\n```\r\n\r\nTest Script (Invoke-GetProcess.ps1)\r\n```powershell\r\nInvoke-Expression \"Get-Process\"\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```none\r\nInvoke-ScriptAnalyzer -Path ./Invoke-GetProcess.ps1 -CustomRulePath ./Measure-AvoidCustomInvokeExpression.psm1 -Severity Error\r\n\r\nRuleName                            Severity     ScriptName Line  Message\r\n--------                            --------     ---------- ----  -------\r\nCustom Name                         Error        Invoke-Get 1     Stop it!\r\n                                                 Process.ps\r\n                                                 1\r\n```\r\n\r\nActual behavior\r\n---------------\r\nUsed with `-Severity Error`\r\n```none\r\nInvoke-ScriptAnalyzer -Path ./Invoke-GetProcess.ps1 -CustomRulePath ./Measure-AvoidCustomInvokeExpression.psm1 -Severity Error\r\n\r\n\u003cnothing>\r\n```\r\n\r\nUsed with `-Severity Warning`\r\n```none\r\nInvoke-ScriptAnalyzer -Path ./Invoke-GetProcess.ps1 -CustomRulePath ./Measure-AvoidCustomInvokeExpression.psm1 -Severity Warning\r\n\r\nRuleName                            Severity     ScriptName Line  Message\r\n--------                            --------     ---------- ----  -------\r\nCustom Name                         Error        Invoke-Get 1     Stop it!\r\n                                                 Process.ps\r\n                                                 1\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- Provide the output of the following 2 commands -->\r\n\r\nWindows 11\r\n```PowerShell\r\n> $PSVersionTable\r\nPSVersion                      5.1.22621.4391\r\nPSEdition                      Desktop\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}\r\nBuildVersion                   10.0.22621.4391\r\nCLRVersion                     4.0.30319.42000\r\nWSManStackVersion              3.0\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\n\r\n> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n1.23.0\r\n```\r\n\r\nManjaro 6.6.63-1\r\n```Powershell\r\n> $PSVersionTable\r\nPSVersion                      7.4.1\r\nPSEdition                      Core\r\nGitCommitId                    7.4.1-0-g5668713d3c906d63cd68e37d415206a95ac061d0\r\nOS                             Manjaro Linux\r\nPlatform                       Unix\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\nWSManStackVersion              3.0\r\n\r\n> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n1.23.0\r\n```\r\n","author":{"url":"https://github.com/Geevo","@type":"Person","name":"Geevo"},"datePublished":"2024-12-16T14:05:24Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/2049"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d114fbe0-9536-8bf4-bb82-aaaa5d993d35
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBC22:E9A8B:14132EA:1C616C8:6AFCE47A
html-safe-nonce2d585f0a83e544df58308277dead44149f31b26ab025be7a6bee25aeeca46eb5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzIyOkU5QThCOjE0MTMyRUE6MUM2MTZDODo2QUZDRTQ3QSIsInZpc2l0b3JfaWQiOiI2NjQ5NzY3MzM3ODQwNjY1NzIyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca42ec50f016daf1108ada6a887df8692fb80f0a664a9d805ca496a08c07ab07a
hovercard-subject-tagissue:2742486046
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PSScriptAnalyzer/2049/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e42d08c367317604e52572ce27884bf3df2fc29312fd69d4ca2b50aba2f3cba4/PowerShell/PSScriptAnalyzer/issues/2049
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e42d08c367317604e52572ce27884bf3df2fc29312fd69d4ca2b50aba2f3cba4/PowerShell/PSScriptAnalyzer/issues/2049
og:image:altI'm experiencing an issue with function-based custom rules. When a custom rule returns a severity of Error, the results don't appear under the -Severity Error filter. Instead, they show up only whe...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameGeevo
hostnamegithub.com
expected-hostnamegithub.com
None99aede4c5f55ec5cf06666a8c9e03ebf9f85f7231223e7f1c38c16e5504835b3
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PSScriptAnalyzer git https://github.com/PowerShell/PSScriptAnalyzer.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id33149177
octolytics-dimension-repository_nwoPowerShell/PSScriptAnalyzer
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id33149177
octolytics-dimension-repository_network_root_nwoPowerShell/PSScriptAnalyzer
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseecfd63ca125ec74b42f74eeb158b3fa081c8c497
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PSScriptAnalyzer/issues/2049#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2F2049
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2F2049
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPSScriptAnalyzer
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/2049
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/2049
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/2049
PowerShellhttps://github.com/PowerShell
PSScriptAnalyzerhttps://github.com/PowerShell/PSScriptAnalyzer
Codehttps://github.com/PowerShell/PSScriptAnalyzer
Issues407 (407)https://github.com/PowerShell/PSScriptAnalyzer/issues
Pull requests34 (34)https://github.com/PowerShell/PSScriptAnalyzer/pulls
Discussionshttps://github.com/PowerShell/PSScriptAnalyzer/discussions
Actionshttps://github.com/PowerShell/PSScriptAnalyzer/actions
Projectshttps://github.com/PowerShell/PSScriptAnalyzer/projects
Wikihttps://github.com/PowerShell/PSScriptAnalyzer/wiki
Security and qualityhttps://github.com/PowerShell/PSScriptAnalyzer/security
Insightshttps://github.com/PowerShell/PSScriptAnalyzer/insights
https://github.com/PowerShell/PSScriptAnalyzer
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/2049
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/2049
Function-Based Custom Rule with "Error" Severity Doesn’t Show Under -Severity Errorhttps://github.com/PowerShell/PSScriptAnalyzer/issues/2049#top
Issue - Bughttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Issue%20-%20Bug%22
https://github.com/Geevo
Luke (Geevo)https://github.com/Geevo
on Dec 16, 2024https://github.com/PowerShell/PSScriptAnalyzer/issues/2049#issue-2742486046
#1237https://github.com/PowerShell/PSScriptAnalyzer/issues/1237
Christoph Bergmeister (bergmeister)https://github.com/bergmeister
Issue - Bughttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Issue%20-%20Bug%22
on Mar 12, 2025https://github.com/PowerShell/PSScriptAnalyzer/issues/2049#event-16721327970
https://github.com/liamjpeters
Liam Peters (liamjpeters)https://github.com/liamjpeters
on Feb 20, 2026https://github.com/PowerShell/PSScriptAnalyzer/issues/2049#issuecomment-3936363627
PSScriptAnalyzer/Engine/Generic/ExternalRule.cshttps://github.com/PowerShell/PSScriptAnalyzer/blob/aba29c31151925bd7180e7dfd578e1bfacdaf2a2/Engine/Generic/ExternalRule.cs#L55-L59
aba29c3https://github.com/PowerShell/PSScriptAnalyzer/commit/aba29c31151925bd7180e7dfd578e1bfacdaf2a2
https://github.com/bergmeister
Christoph Bergmeister (bergmeister)https://github.com/bergmeister
on Mar 31, 2026https://github.com/PowerShell/PSScriptAnalyzer/issues/2049#issuecomment-4165075440
#2156https://github.com/PowerShell/PSScriptAnalyzer/issues/2156
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/2049
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/2049
Issue - Bughttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Issue%20-%20Bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.