Update compatibility profiles for PowerShell 7 by rjmholt · Pull Request #1429 · PowerShell/PSScriptAnalyzer
PR Summary
- Adds compatibility profiles for PS 7 and 6.2
- Moves the 6.1 profiles to the optional folder
- Port an old fix for alias collection that never made it in, where we get aliases that don't have any declaring module (ones declared in the initial session state)
- Fix the race condition in query objects causing intermittent test failures (I finally got a local repro) by making query initialisation eager
- Make compatibility rules supressable by their particular command/parameter, type/member names
- Add tests for PS 7 profiles
PR Checklist
- PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
- Change is not breaking
- Make sure all
.cs,.ps1and.psm1files have the correct copyright header - Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
- This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:to the beginning of the title and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
| The rule can also be suppressed only for particular types: | ||
|
|
||
| ```powershell | ||
| [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "", Target="System.Management.Automation.Security.SystemPolicy")] |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be?
| [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "", Target="System.Management.Automation.Security.SystemPolicy")] | |
| [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "System.Management.Automation.Security.SystemPolicy")] |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but 1 or 2 minor comments probably need to be addressed. Also: I'd rather remove the 6.1 profiles as it's usage is unsupported anyway as it heavily adds to the installation payload of PSSA. By the time PSSA ships, even 6.2 will only have a few months support left.
CI needs to be fixed though of course.
CI needs to be fixed though of course.
Yeah it looks like this reflects a legitimate bug... I'll need to look into it
@bergmeister I've got this working now, if you've got time to take a look
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks
| And also suppressed only for parameters: | ||
|
|
||
| ```powershell | ||
| [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleCommands", "Import-Module/FullyQualifiedName")] |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters