René's URL Explorer Experiment


Title: Suppression with `SuppressMessageAttribute` is completely broken for variables · Issue #2040 · PowerShell/PSScriptAnalyzer · GitHub

Open Graph Title: Suppression with `SuppressMessageAttribute` is completely broken for variables · Issue #2040 · PowerShell/PSScriptAnalyzer

X Title: Suppression with `SuppressMessageAttribute` is completely broken for variables · Issue #2040 · PowerShell/PSScriptAnalyzer

Description: Steps to reproduce Consider this code: $foo = "never used" # Should generate PSUseDeclaredVarsMoreThanAssignments $global:var1 = $null # Should generate PSAvoidGlobalVars Now let's try to add these suppressions: [Diagnostics.CodeAnalysis...

Open Graph Description: Steps to reproduce Consider this code: $foo = "never used" # Should generate PSUseDeclaredVarsMoreThanAssignments $global:var1 = $null # Should generate PSAvoidGlobalVars Now let's try to add these...

X Description: Steps to reproduce Consider this code: $foo = "never used" # Should generate PSUseDeclaredVarsMoreThanAssignments $global:var1 = $null # Should generate PSAvoidGlobalVars Now let's tr...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Suppression with `SuppressMessageAttribute` is completely broken for variables","articleBody":"Steps to reproduce\r\n------------------\r\n\r\nConsider this code:\r\n\r\n```powershell\r\n$foo = \"never used\" # Should generate PSUseDeclaredVarsMoreThanAssignments\r\n\r\n$global:var1 = $null # Should generate PSAvoidGlobalVars\r\n```\r\n\r\nNow let's try to add these suppressions:\r\n\r\n```powershell\r\n[Diagnostics.CodeAnalysis.SuppressMessage('NonexistentRule', '')]\r\n$foo = \"never used\" # Should still generate PSUseDeclaredVarsMoreThanAssignments\r\n\r\n[Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidGlobalVars', '')]\r\n$global:var1 = $null # Should NOT generate PSAvoidGlobalVars\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nI should still see the `PSUseDeclaredVarsMoreThanAssignments` warning, but not the `PSAvoidGlobalVars` one.\r\n\r\nActual behavior\r\n---------------\r\n\r\nThe opposite happens, the first message is suppressed, but the second is not:\r\n\r\n```\r\nRuleName                             Severity     ScriptName Line  Message\r\n--------                             --------     ---------- ----  -------\r\nPSAvoidGlobalVars                    Warning      Test.ps1      5     Found global variable 'global:var1'.\r\n```\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\n\u003e $PSVersionTable\r\n\r\nName                           Value\r\n----                           -----\r\nPSVersion                      7.4.5\r\nPSEdition                      Core\r\nGitCommitId                    7.4.5\r\nOS                             Microsoft Windows 10.0.22631\r\nPlatform                       Win32NT\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\u003e (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n1.23.0\r\n```\r\n","author":{"url":"https://github.com/BalassaMarton","@type":"Person","name":"BalassaMarton"},"datePublished":"2024-10-31T09:33:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2040/PSScriptAnalyzer/issues/2040"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:34bbbf48-d1ba-3211-d5f6-fed5e89e478c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC058:2E90F6:1FA1BD3:2DE6CF8:6A55006B
html-safe-nonce50dcd34140192005ec80bf5090b0aa2282a20f04969205c8023e0c4a14f58e9b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDU4OjJFOTBGNjoxRkExQkQzOjJERTZDRjg6NkE1NTAwNkIiLCJ2aXNpdG9yX2lkIjoiNTE5NTcxMTM1MjM4NDMyMzY5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac87d59ef83d0bab6877246d992f41b6819b481183528f02b0f86bc42f26d3c7ae
hovercard-subject-tagissue:2626400069
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/2040/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9bdc20ddbea358a48ee38536f9a925d26ac5afb0fd19541e377fd308230a96d1/PowerShell/PSScriptAnalyzer/issues/2040
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9bdc20ddbea358a48ee38536f9a925d26ac5afb0fd19541e377fd308230a96d1/PowerShell/PSScriptAnalyzer/issues/2040
og:image:altSteps to reproduce Consider this code: $foo = "never used" # Should generate PSUseDeclaredVarsMoreThanAssignments $global:var1 = $null # Should generate PSAvoidGlobalVars Now let's try to add these...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameBalassaMarton
hostnamegithub.com
expected-hostnamegithub.com
Noneeae2aab99907699a22d2c8449aa683ca74454fca87211b98f7c7b722086b2839
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
release6a35ab858be185cd86d12b93a43bccf34e8d8536
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PSScriptAnalyzer/issues/2040#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2F2040
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPSScriptAnalyzer%2Fissues%2F2040
Sign up https://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/2040
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/2040
Reloadhttps://github.com/PowerShell/PSScriptAnalyzer/issues/2040
Please reload this pagehttps://github.com/PowerShell/PSScriptAnalyzer/issues/2040
PowerShell https://github.com/PowerShell
PSScriptAnalyzerhttps://github.com/PowerShell/PSScriptAnalyzer
Notifications https://github.com/login?return_to=%2FPowerShell%2FPSScriptAnalyzer
Fork 409 https://github.com/login?return_to=%2FPowerShell%2FPSScriptAnalyzer
Star 2.1k https://github.com/login?return_to=%2FPowerShell%2FPSScriptAnalyzer
Code https://github.com/PowerShell/PSScriptAnalyzer
Issues 393 https://github.com/PowerShell/PSScriptAnalyzer/issues
Pull requests 14 https://github.com/PowerShell/PSScriptAnalyzer/pulls
Discussions https://github.com/PowerShell/PSScriptAnalyzer/discussions
Actions https://github.com/PowerShell/PSScriptAnalyzer/actions
Projects https://github.com/PowerShell/PSScriptAnalyzer/projects
Wiki https://github.com/PowerShell/PSScriptAnalyzer/wiki
Security and quality 0 https://github.com/PowerShell/PSScriptAnalyzer/security
Insights https://github.com/PowerShell/PSScriptAnalyzer/pulse
Code https://github.com/PowerShell/PSScriptAnalyzer
Issues https://github.com/PowerShell/PSScriptAnalyzer/issues
Pull requests https://github.com/PowerShell/PSScriptAnalyzer/pulls
Discussions https://github.com/PowerShell/PSScriptAnalyzer/discussions
Actions https://github.com/PowerShell/PSScriptAnalyzer/actions
Projects https://github.com/PowerShell/PSScriptAnalyzer/projects
Wiki https://github.com/PowerShell/PSScriptAnalyzer/wiki
Security and quality https://github.com/PowerShell/PSScriptAnalyzer/security
Insights https://github.com/PowerShell/PSScriptAnalyzer/pulse
Suppression with SuppressMessageAttribute is completely broken for variableshttps://github.com/PowerShell/PSScriptAnalyzer/issues/2040#top
https://github.com/BalassaMarton
BalassaMartonhttps://github.com/BalassaMarton
on Oct 31, 2024https://github.com/PowerShell/PSScriptAnalyzer/issues/2040#issue-2626400069
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.