Title: Rule Request: UnknownLabel · Issue #2145 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Rule Request: UnknownLabel · Issue #2145 · PowerShell/PSScriptAnalyzer
X Title: Rule Request: UnknownLabel · Issue #2145 · PowerShell/PSScriptAnalyzer
Description: Not sure whether this is a PowerShell a bug or feature but fixing it in PowerShell would probably be a break change. In any case, I think unknown labels should be notified and even deserve an error severity if the label doesn't exist or ...
Open Graph Description: Not sure whether this is a PowerShell a bug or feature but fixing it in PowerShell would probably be a break change. In any case, I think unknown labels should be notified and even deserve an error...
X Description: Not sure whether this is a PowerShell a bug or feature but fixing it in PowerShell would probably be a break change. In any case, I think unknown labels should be notified and even deserve an error...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/2145
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Rule Request: UnknownLabel","articleBody":"Not sure whether [this](https://stackoverflow.com/a/45030002/1701026) is a PowerShell a bug or feature but fixing it in PowerShell would probably be a break change.\n\nIn any case, I think unknown labels should be notified and even deserve an **error** severity if the label doesn't exist or is outside the concerned loop. \n\n```PowerShell\nInvoke-ScriptAnalyzer -ScriptDefinition {\n :foo foreach ($a in 1,2,3) {\n $a\n if ($a -ge $b) { break bar }\n }\n}.ToString()\n```\n\n**Expected**\nSomething like:\n```\nRuleName Severity ScriptName Line Message\n-------- -------- ---------- ---- -------\nPSUnknownLabel Error 4 The label 'bar' is not known in this context\n```\n\nSee also: [Pester breaks on functions with unknown label](https://github.com/pester/Pester/issues/2669)","author":{"url":"https://github.com/iRon7","@type":"Person","name":"iRon7"},"datePublished":"2025-12-04T11:16:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2145/PSScriptAnalyzer/issues/2145"}
| 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:7a0cea0c-29e0-d1be-50d2-586c4c229dc9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6BC:3F0EBB:B59C3E:F9D7C8:696504C7 |
| html-safe-nonce | e42dff2fb21dc76b1305c4faa7705d0c00bc24902a8c027e88d49e819c8f520a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkJDOjNGMEVCQjpCNTlDM0U6RjlEN0M4OjY5NjUwNEM3IiwidmlzaXRvcl9pZCI6IjQxOTI5Njk4NjAzNzIwMzg4NTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bde7dc3987e4c18d39e20cdbbeb61df4d80f14f91e6d2ec32c621c2b5b55c7c7 |
| hovercard-subject-tag | issue:3694142457 |
| 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/2145/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f7eeb82a8255c9cf3a1262391d025d39933bcc8ab3d4302ab10d0ed34db9d778/PowerShell/PSScriptAnalyzer/issues/2145 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f7eeb82a8255c9cf3a1262391d025d39933bcc8ab3d4302ab10d0ed34db9d778/PowerShell/PSScriptAnalyzer/issues/2145 |
| og:image:alt | Not sure whether this is a PowerShell a bug or feature but fixing it in PowerShell would probably be a break change. In any case, I think unknown labels should be notified and even deserve an error... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iRon7 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5ab78b37645aad755632aa5585d27672721953ada88ee2fd72e109792b528c77 |
| 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 | ad8012c2b69c74234a24730a05d4683cea54801a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width