★ wanayoo — archive 1999 https://github.com/PowerShell/PSScriptAnalyzer/pull/933Nouvelle recherche | Portail wanayoo
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

WIP Warn when using += on array objects #933

Open
wants to merge 8 commits into
base: development
from

Conversation

@bergmeister
Copy link
Collaborator

bergmeister commented Mar 14, 2018 •

PR Summary

Fixes #806 and #904
It is well know that PowerShell's += operator always creates a new array under the hood even if the array type is not of fixed size.
Because SSA (single statement analysis) is not fully implemented at the moment, the detection for the object type can not catch all cases. For example it does not work inside function definitions or cannot determine if the object is of type string at the moment or cases like $a=@(); $a+=$foo.
The rule documentation includes all possible info even if strings cannot be caught at the moment.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets. Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • User facing documentation needed
  • Change is not breaking
  • Make sure you've added a new test if existing tests do not effectively test the code changed
  • 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
bergmeister added 3 commits Mar 14, 2018
…s because SSA is not fully implemented (i.e. $a=@();$a+=$foo does not get caught or determining that the type is of type string.
bergmeister added 5 commits Mar 30, 2018
…nalyzer into WarnPlusEquals

resolved by taking both
# Conflicts:
#	Rules/Strings.resx
…nalyzer into WarnPlusEquals

Resolved by taking both.
# Conflicts:
#	Rules/Strings.resx
…nalyzer into WarnPlusEquals

# Conflicts:
#	Rules/Strings.resx
…nalyzer into WarnPlusEquals

# Conflicts:
#	Rules/Strings.resx
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.

1 participant
You can’t perform that action at this time.