Skip to content

Conversation

@xtqqczze
Copy link
Contributor

PR Summary

Avoid variable names that conflict with automatic variables.

PR Context

Variable names such as $error and $pid cause a PSScriptAnalyzer rule violation of type AvoidAssignmentToAutomaticVariable

PR Checklist

@iSazonov iSazonov added the CL-Tools Indicates that a PR should be marked as a tools change in the Change Log label Dec 18, 2019
@iSazonov iSazonov added this to the 7.1.0-preview.1 milestone Dec 18, 2019
@anmenaga
Copy link

@xtqqczze As far as i understand, this is a workaround for a problem in PSScriptAnalyzer, so it would be good to add an issue fro PSScriptAnalyzer for this.

@anmenaga anmenaga merged commit 7a73652 into PowerShell:master Dec 20, 2019
@xtqqczze
Copy link
Contributor Author

xtqqczze commented Dec 20, 2019

@anmenaga I think this is expected behavior, as per AvoidAssignmentToAutomaticVariable rule documentation.

The variable $Error is an automatic variables that exists in the global scope and should therefore never be used as a variable or parameter name.

@xtqqczze xtqqczze deleted the AvoidAssignmentToAutomaticVariable branch January 8, 2020 11:39
@ghost
Copy link

ghost commented Mar 26, 2020

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Tools Indicates that a PR should be marked as a tools change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants