Title: Ability for script exclusions for PSUseCompatible* rules · Issue #1347 · PowerShell/PSScriptAnalyzer · GitHub
Open Graph Title: Ability for script exclusions for PSUseCompatible* rules · Issue #1347 · PowerShell/PSScriptAnalyzer
X Title: Ability for script exclusions for PSUseCompatible* rules · Issue #1347 · PowerShell/PSScriptAnalyzer
Description: Summary of the new feature When using PSUseCompatible* rules with target profiles for PSv3, PSSA generates a whole bunch of issues for Pester tests that I have inside of my Script/Module projects. My Dev machine, as well as build machine...
Open Graph Description: Summary of the new feature When using PSUseCompatible* rules with target profiles for PSv3, PSSA generates a whole bunch of issues for Pester tests that I have inside of my Script/Module projects. ...
X Description: Summary of the new feature When using PSUseCompatible* rules with target profiles for PSv3, PSSA generates a whole bunch of issues for Pester tests that I have inside of my Script/Module projects. ...
Opengraph URL: https://github.com/PowerShell/PSScriptAnalyzer/issues/1347
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ability for script exclusions for PSUseCompatible* rules","articleBody":"**Summary of the new feature**\r\n\r\nWhen using `PSUseCompatible*` rules with target profiles for PSv3, PSSA generates a whole bunch of issues for Pester tests that I have inside of my Script/Module projects. My Dev machine, as well as build machines run latest version of PowerShell, and the tests don't get bundled with my script/modules, hence I don't really care whether they'd run on versions other than latest. It would be really great if I could exclude my Test scripts (by path, by name pattern, or by name) just for these rules, and keep the rest of the rules active.\r\n\r\n**Proposed technical implementation details (optional)**\r\nIntroduce an additional configuration setting for `PSUseCompatible*` rules, i.e. `IgnoreScriptPath` as follows:\r\n```Posh\r\n@{\r\n Rules = @{\r\n PSUseCompatibleCommands = @{\r\n Enable = $true\r\n TargetProfiles = @(...);\r\n\r\n IgnoreScriptPath = @(\r\n './Tests/', # Ignore any scripts within the Tests sub-folder\r\n './*.ps1', # Ignore all PowerShell scripts withing the root folder (i.e. build scripts)\r\n './HelperScripts/SomeHelperScriptForMyBuild.ps1' # Ignore a single helper file\r\n )\r\n };\r\n\r\n PSUseCompatibleSyntax = @{\r\n Enable = $true\r\n TargetedVersions = @(...)\r\n\r\n IgnoreScriptPath = @(\r\n './Tests/', # Ignore any scripts within the Tests sub-folder\r\n './*.ps1', # Ignore all PowerShell scripts withing the root folder (i.e. build scripts)\r\n './HelperScripts/SomeHelperScriptForMyBuild.ps1' # Ignore a single helper file\r\n )\r\n };\r\n\r\n PSUseCompatibleTypes = @{\r\n Enable = $true\r\n TargetProfiles = @(...)\r\n\r\n IgnoreScriptPath = @(\r\n './Tests/', # Ignore any scripts within the Tests sub-folder\r\n './*.ps1', # Ignore all PowerShell scripts withing the root folder (i.e. build scripts)\r\n './HelperScripts/SomeHelperScriptForMyBuild.ps1' # Ignore a single helper file\r\n )\r\n };\r\n\r\n 'PSUseCompatibleCmdlets' = @{\r\n 'compatibility' = @(...)\r\n\r\n 'IgnoreScriptPath' = @(\r\n './Tests/', # Ignore any scripts within the Tests sub-folder\r\n './*.ps1', # Ignore all PowerShell scripts withing the root folder (i.e. build scripts)\r\n './HelperScripts/SomeHelperScriptForMyBuild.ps1' # Ignore a single helper file\r\n )\r\n }\r\n }\r\n}\r\n```\r\n\r\nAlternatively, given that the collection of paths to ignore would most likely be identical for all the `PSUseCompatible*` rules, it might actually be easier to mention it once in a separate place, i.e.:\r\n```Posh\r\n@{\r\n Rules = @{\r\n ...\r\n }\r\n 'PSUseCompatibleRulesIgnoreScriptPath' = @(\r\n './Tests/', # Ignore any scripts within the Tests sub-folder\r\n './*.ps1', # Ignore all PowerShell scripts withing the root folder (i.e. build scripts)\r\n './HelperScripts/SomeHelperScriptForMyBuild.ps1' # Ignore a single helper file\r\n )\r\n}\r\n```\r\n\r\n**What is the latest version of PSScriptAnalyzer at the point of writing**\r\n1.18.3\r\n","author":{"url":"https://github.com/Glober777","@type":"Person","name":"Glober777"},"datePublished":"2019-09-26T19:19:37Z","url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1347"}
| 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:06b16a25-ee8d-6c50-10e0-36e0be7fd192 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B332:26F3E6:0ACD:0E4B:6AFCE83A |
| html-safe-nonce | 6951f709344b5421dbed7461890213c14577acbae5a1724f3823f9b0aa4797e7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzMyOjI2RjNFNjowQUNEOjBFNEI6NkFGQ0U4M0EiLCJ2aXNpdG9yX2lkIjoiMzM0MDg0MTY0MDEzMzQ1Mzg4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 55d4015fdcacb15b089f2aa577ef80aee984ac85679e7fe67d211d2f3b32d4a3 |
| hovercard-subject-tag | issue:499069105 |
| 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/1347/issue_layout |
| twitter:image | https://opengraph.githubassets.com/689dfb93088643fd482ae56a65cb956fcbea63410cced7c67eddb401d15422bf/PowerShell/PSScriptAnalyzer/issues/1347 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/689dfb93088643fd482ae56a65cb956fcbea63410cced7c67eddb401d15422bf/PowerShell/PSScriptAnalyzer/issues/1347 |
| og:image:alt | Summary of the new feature When using PSUseCompatible* rules with target profiles for PSv3, PSSA generates a whole bunch of issues for Pester tests that I have inside of my Script/Module projects. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Glober777 |
| 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