Title: Rule request: Avoid reserved words for functions names · Issue #2099 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Rule request: Avoid reserved words for functions names · Issue #2099 · PowerShell/PSScriptAnalyzer
X Title: Rule request: Avoid reserved words for functions names · Issue #2099 · PowerShell/PSScriptAnalyzer
Description: According the document about Reserved Words, the reserved words that cannot be used as identifiers because they have a special meaning in PowerShell: about_Reserved_Words Short description Lists the reserved words that cannot be used as ...
Open Graph Description: According the document about Reserved Words, the reserved words that cannot be used as identifiers because they have a special meaning in PowerShell: about_Reserved_Words Short description Lists th...
X Description: According the document about Reserved Words, the reserved words that cannot be used as identifiers because they have a special meaning in PowerShell: about_Reserved_Words Short description Lists th...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/2099
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Rule request: Avoid reserved words for functions names","articleBody":"According the document [about Reserved Words](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_reserved_words), *the reserved words that cannot be used as identifiers because they\nhave a special meaning in PowerShell*:\n\n---\n\n# about_Reserved_Words\n\n## Short description\n\nLists the reserved words that cannot be used as identifiers because they\nhave a special meaning in PowerShell.\n\n## Long description\n\nThere are certain words that have special meaning in PowerShell. When these\nwords appear without quotation marks, PowerShell attempts to apply their\nspecial meaning rather than treating them as character strings. To use these\nwords as parameter arguments in a command or script without invoking their\nspecial meaning, enclose the reserved words in quotation marks.\n\nThe following are the reserved words in PowerShell:\n\n```\nassembly exit process\nbase filter public\nbegin finally return\nbreak for sequence\ncatch foreach static\nclass from (*) switch\ncommand function throw\nconfiguration hidden trap\ncontinue if try\ndata in type\ndefine (*) inlinescript until\ndo interface using\ndynamicparam module var (*)\nelse namespace while\nelseif parallel workflow\nend param\nenum private\n\n(*) These keywords are reserved for future use.\n```\n\n---\n\nIt would be nice if the script analyzer warns (or even errors) if any of these names are used for a function name.\nE.g. I would expect the following script definition to return an issue:\n```PowerShell\nInvoke-ScriptAnalyzer -ScriptDefinition {function if {}}.ToString()\n```\n","author":{"url":"https://github.com/iRon7","@type":"Person","name":"iRon7"},"datePublished":"2025-04-30T07:31:45Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/2099"}
| 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:4c15e37f-839a-ec98-03bc-c15bfaedbe5e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B306:18B7E8:3BE717:4F28CC:6AFCE743 |
| html-safe-nonce | cc4091c37750f245056647ab490ac6c5d408514be1e1c074fc28bffa14de1a63 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzA2OjE4QjdFODozQkU3MTc6NEYyOENDOjZBRkNFNzQzIiwidmlzaXRvcl9pZCI6Ijc4MDkxMDA1MDI3NzA5NjgzODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3beae970136a5d34f1783e4db98fc67f130ed4b14538e08f6eceaa2514eb4156 |
| hovercard-subject-tag | issue:3030404698 |
| 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/2099/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7745ff48e760d5dbbbd1c17e4380fd5493fb77ddc66f561bf68d497747fb5ae4/PowerShell/PSScriptAnalyzer/issues/2099 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7745ff48e760d5dbbbd1c17e4380fd5493fb77ddc66f561bf68d497747fb5ae4/PowerShell/PSScriptAnalyzer/issues/2099 |
| og:image:alt | According the document about Reserved Words, the reserved words that cannot be used as identifiers because they have a special meaning in PowerShell: about_Reserved_Words Short description Lists th... |
| 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 | 99aede4c5f55ec5cf06666a8c9e03ebf9f85f7231223e7f1c38c16e5504835b3 |
| 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 | ecfd63ca125ec74b42f74eeb158b3fa081c8c497 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width