PowerShell / PowerShell/PSScriptAnalyzer
ValidateRange boundary type vs parameter type check
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
Summary of the new feature
For ValidateRange, check that the boundary type match the parameter types. The reason is that integer literals silently accepts values outside the declared range on [double], [float], [decimal] types
A clear and concise description of what the problem is that the new feature would solve.
Try formulating it in user story style (if applicable):
I wrote it up in this article
https://www.reddit.com/r/PowerShell/comments/1vbsyfc/til_validaterange_with_integer_literals_silently/
Proposed technical implementation details (optional)
A clear and concise description of what you want to happen.
I'd like to see the PSScriptAnalyzer highlight an inconsistency in types in the same way that it does for other errors.
This would be shown in the output list when you run it against a script.
What is the latest version of PSScriptAnalyzer at the point of writing
1.25
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
No files or tests are named. Start by locating existing ValidateRange handling and analyzer rule tests, then run PSScriptAnalyzer on examples using integer boundaries with double, float, or decimal parameters. Done means the inconsistency produces an analyzer diagnostic with coverage for the reported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100