René's URL Explorer Experiment


Title: Cmdlets that run in current scope (like ForEach-Object) not accounted for by PSUseDeclaredVarsMoreThanAssignments · Issue #1163 · PowerShell/PSScriptAnalyzer · GitHub

Open Graph Title: Cmdlets that run in current scope (like ForEach-Object) not accounted for by PSUseDeclaredVarsMoreThanAssignments · Issue #1163 · PowerShell/PSScriptAnalyzer

X Title: Cmdlets that run in current scope (like ForEach-Object) not accounted for by PSUseDeclaredVarsMoreThanAssignments · Issue #1163 · PowerShell/PSScriptAnalyzer

Description: Although issue #1031 and #1129 probably have the same cause, I have added a new bug report as it is (afaik) not directly related to the Begin, Process and End function blocks as suggested in there which brings the issue in a different pe...

Open Graph Description: Although issue #1031 and #1129 probably have the same cause, I have added a new bug report as it is (afaik) not directly related to the Begin, Process and End function blocks as suggested in there ...

X Description: Although issue #1031 and #1129 probably have the same cause, I have added a new bug report as it is (afaik) not directly related to the Begin, Process and End function blocks as suggested in there ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cmdlets that run in current scope (like ForEach-Object) not accounted for by PSUseDeclaredVarsMoreThanAssignments","articleBody":"Although issue #1031 and #1129 probably have the same cause, I have added a new bug report as it is (afaik) not directly related to the `Begin`, `Process` and `End` function blocks as suggested in there which brings the issue in a different perspective.\r\n\r\nApparently for some cmdlets, PowerShell [is invoked in the current scope](https://www.powershellmagazine.com/2014/10/22/foreach-and-where-magic-methods/) but that is apparently *not* respected by the PSScriptAnalyzer.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```PowerShell\r\n$Test = $False\r\n1..3 | ForEach-Object {$Test = $True}\r\n$Test\r\n```\r\nnote that the result of the above is `$True`, meaning that the value of `$Test` is actually assigned and changed to `$True` within the `ForEach-Object` cmdlet.\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nNo warning.\r\n\r\nActual behavior\r\n---------------\r\n\r\n```none\r\nRuleName                            Severity     ScriptName Line  Message\r\n--------                            --------     ---------- ----  -------\r\nPSUseDeclaredVarsMoreThanAssignment Warning      Test.ps1   2     The variable 'Test' is assigned but never used.\r\n```\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\n```PowerShell\r\nName                           Value\r\n----                           -----\r\nPSVersion                      5.1.17134.590\r\nPSEdition                      Desktop\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion                   10.0.17134.590\r\nCLRVersion                     4.0.30319.42000\r\nWSManStackVersion              3.0\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\n\r\nPSScriptAnalyzer.Version:    1.17.1\r\n\r\n```\r\n\r\nWill this eventually be resolved?\r\nHow can I nicely avoid the incorrect warning in an example like above?","author":{"url":"https://github.com/iRon7","@type":"Person","name":"iRon7"},"datePublished":"2019-03-04T08:25:15Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1163"}

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:757d1dc9-a29c-d935-9eb5-44b9a4bc8000
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB4DC:2ED338:1406CE:1A3869:6AFCFE44
html-safe-nonce65e4d19a71616ca0bc5d15f689f3ba6c048457363cc42f44c69079782b50d39d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNERDOjJFRDMzODoxNDA2Q0U6MUEzODY5OjZBRkNGRTQ0IiwidmlzaXRvcl9pZCI6IjU1MzU3Nzc5MjkzNjA2Mzc1MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac54bd28f3d3df4082acf20435921847a10a931dea02271e6e2d9a0ddccbea0f84
hovercard-subject-tagissue:416683583
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/1163/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c52a006ebaff79118d798d1496b73b15c0ab8b6c74309b3627f5ec5c9e70465e/PowerShell/PSScriptAnalyzer/issues/1163
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c52a006ebaff79118d798d1496b73b15c0ab8b6c74309b3627f5ec5c9e70465e/PowerShell/PSScriptAnalyzer/issues/1163
og:image:altAlthough issue #1031 and #1129 probably have the same cause, I have added a new bug report as it is (afaik) not directly related to the Begin, Process and End function blocks as suggested in there ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameiRon7
hostnamegithub.com
expected-hostnamegithub.com
Nonecfabad6ee26d2b84c7afef4ae0cc71b8b692fb9d66f9f15997652ef991bfd3f4
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
release35f85b78676038389558a41adf8d76e474592ede
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PSScriptAnalyzer/issues/1163#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2F1163
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%2F1163
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/1163
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/1163
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/1163
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/1163
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/1163
Cmdlets that run in current scope (like ForEach-Object) not accounted for by PSUseDeclaredVarsMoreThanAssignmentshttps://github.com/PowerShell/PSScriptAnalyzer/issues/1163#top
Area - Enginehttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Area%20-%20Engine%22
Area - PSUseDeclaredVarsMoreThanAssignmentshttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Area%20-%20PSUseDeclaredVarsMoreThanAssignments%22
Issue - Enhancementhttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Issue%20-%20Enhancement%22
https://github.com/iRon7
iRon7https://github.com/iRon7
on Mar 4, 2019https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issue-416683583
#1031https://github.com/PowerShell/PSScriptAnalyzer/issues/1031
#1129https://github.com/PowerShell/PSScriptAnalyzer/issues/1129
is invoked in the current scopehttps://www.powershellmagazine.com/2014/10/22/foreach-and-where-magic-methods/
https://github.com/VonRegi
Thomas Budds (VonRegi)https://github.com/VonRegi
on Mar 20, 2019https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-474696604
Robert McLeod (@RobFaie)https://github.com/RobFaie
https://user-images.githubusercontent.com/22757114/54662576-8eef3480-4b32-11e9-90df-313aa8147960.png
https://github.com/iRon7
iRon7https://github.com/iRon7
on Mar 21, 2019https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-475355758
https://www.powershellgallery.com/packages/Joinhttps://www.powershellgallery.com/packages/Join
https://github.com/bergmeister
Christoph Bergmeister (bergmeister)https://github.com/bergmeister
on Mar 21, 2019https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-475425362
https://github.com/pcgeek86
Trevor Sullivan (pcgeek86)https://github.com/pcgeek86
on Oct 1, 2019https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-536842839
https://user-images.githubusercontent.com/466713/65931729-c3845880-e3bf-11e9-936d-6c89b677ffd4.png
Sydney Smith (SydneyhSmith)https://github.com/SydneyhSmith
Area - Enginehttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Area%20-%20Engine%22
Issue - Enhancementhttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Issue%20-%20Enhancement%22
on Jan 16, 2020https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#event-2955340731
https://github.com/FireInWinter
FireInWinterhttps://github.com/FireInWinter
on Mar 5, 2020https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-595321309
Christoph Bergmeister (bergmeister)https://github.com/bergmeister
Area - PSUseDeclaredVarsMoreThanAssignmentshttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Area%20-%20PSUseDeclaredVarsMoreThanAssignments%22
on Mar 5, 2020https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#event-3102079969
https://github.com/bergmeister
Christoph Bergmeister (bergmeister)https://github.com/bergmeister
on Mar 5, 2020https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-595337924
Area - PSUseDeclaredVarsMoreThanAssignments https://github.com/PowerShell/PSScriptAnalyzer/labels/Area%20-%20PSUseDeclaredVarsMoreThanAssignments
#1031https://github.com/PowerShell/PSScriptAnalyzer/issues/1031
FireInWinterhttps://github.com/FireInWinter
https://github.com/amis92
Amadeusz Sadowski (amis92)https://github.com/amis92
on Apr 17, 2020https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-615483225
Rob Holt (rjmholt)https://github.com/rjmholt
on Feb 9, 2021https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#event-4312034239
Rob Holt (rjmholt)https://github.com/rjmholt
on Aug 11, 2021https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#event-5145065807
https://github.com/nascentt
nascentthttps://github.com/nascentt
on Jan 21, 2022https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-1018419566
https://github.com/Peter-76
Peter-76https://github.com/Peter-76
on May 24, 2024https://github.com/PowerShell/PSScriptAnalyzer/issues/1163#issuecomment-2128598469
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/1163
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PSScriptAnalyzer/issues/1163
Area - Enginehttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Area%20-%20Engine%22
Area - PSUseDeclaredVarsMoreThanAssignmentshttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Area%20-%20PSUseDeclaredVarsMoreThanAssignments%22
Issue - Enhancementhttps://github.com/PowerShell/PSScriptAnalyzer/issues?q=state%3Aopen%20label%3A%22Issue%20-%20Enhancement%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.