PowerShell / PowerShell/PSScriptAnalyzer
New Rule Suggestion / Rule amendment - in response to #903
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
In Issue #903 the rule in my opinion correctly throws on a += for simple defined arrays using the $var = @() method of defining an array to the var variable
I would suggest that a new rule is created that correctly identifies this method as being an expensive action and that a recommendation to use a fully defined Array collection would be a better suggestion, initially suggesting using a System.Collections.ArrayList
This rule should look for both @() & += and suggest converting these calls better scripting practices
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue #903 and the existing rule that handles += for arrays. Determine how the analyzer should recognize both @() and +=, then define the recommendation and tests needed to confirm that fully defined collections, initially System.Collections.ArrayList, are suggested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- devtools, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100