X Tutup
The Wayback Machine - https://web.archive.org/web/20200918095451/https://github.com/PowerShell/PSScriptAnalyzer/pull/1429
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update compatibility profiles for PowerShell 7 #1429

Merged
merged 22 commits into from Mar 31, 2020

Conversation

@rjmholt
Copy link
Member

rjmholt commented Mar 27, 2020

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

The rule can also be suppressed only for particular types:

```powershell
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "", Target="System.Management.Automation.Security.SystemPolicy")]

This comment has been minimized.

@TylerLeonhardt

TylerLeonhardt Mar 28, 2020 Member

Shouldn't this be?

Suggested change
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "", Target="System.Management.Automation.Security.SystemPolicy")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleTypes", "System.Management.Automation.Security.SystemPolicy")]
Copy link
Collaborator

bergmeister left a comment

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.

@rjmholt
Copy link
Member Author

rjmholt commented Mar 28, 2020

CI needs to be fixed though of course.

Yeah it looks like this reflects a legitimate bug... I'll need to look into it

rjmholt added 10 commits Mar 30, 2020
@rjmholt
Copy link
Member Author

rjmholt commented Mar 31, 2020

@bergmeister I've got this working now, if you've got time to take a look

RuleDocumentation/UseCompatibleCommands.md Outdated Show resolved Hide resolved
Copy link
Collaborator

bergmeister left a comment

Awesome, thanks

And also suppressed only for parameters:

```powershell
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseCompatibleCommands", "Import-Module/FullyQualifiedName")]

This comment has been minimized.

@rjmholt rjmholt merged commit b6e0736 into PowerShell:master Mar 31, 2020
12 checks passed
12 checks passed
PSScriptAnalyzer-CI Build #20200331.14 succeeded
Details
PSScriptAnalyzer-CI (Build Full_Build) Build Full_Build succeeded
Details
PSScriptAnalyzer-CI (Test Ubuntu_16_04) Test Ubuntu_16_04 succeeded
Details
PSScriptAnalyzer-CI (Test Ubuntu_18_04) Test Ubuntu_18_04 succeeded
Details
PSScriptAnalyzer-CI (Test Windows_Server2016_PowerShell_5_1) Test Windows_Server2016_PowerShell_5_1 succeeded
Details
PSScriptAnalyzer-CI (Test Windows_Server2016_PowerShell_Core) Test Windows_Server2016_PowerShell_Core succeeded
Details
PSScriptAnalyzer-CI (Test Windows_Server2019_PowerShell_5_1) Test Windows_Server2019_PowerShell_5_1 succeeded
Details
PSScriptAnalyzer-CI (Test Windows_Server2019_PowerShell_Core) Test Windows_Server2019_PowerShell_Core succeeded
Details
PSScriptAnalyzer-CI (Test macOS_10_14_Mojave) Test macOS_10_14_Mojave succeeded
Details
PSScriptAnalyzer-CI (Test macOS_10_15_Catalina) Test macOS_10_15_Catalina succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla All CLA requirements met.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.
X Tutup