Skip to content

Add new InvalidMultiDotValue rule#2180

Open
iRon7 wants to merge 1 commit intoPowerShell:mainfrom
iRon7:#1698InvalidVersionConstruction
Open

Add new InvalidMultiDotValue rule#2180
iRon7 wants to merge 1 commit intoPowerShell:mainfrom
iRon7:#1698InvalidVersionConstruction

Conversation

@iRon7
Copy link
Copy Markdown

@iRon7 iRon7 commented Apr 28, 2026

PR Summary

Issue: #1698

PowerShell does not support an implicit value with multiple dots.
Any unquoted value with 2 or more dots will not be treated as any special type (like a version or IPAddress)
but result in $null. These objects need to be constructed from either a quoted string (e.g. [Version]'1.2.3')
or their individual components (e.g. [Version]::new(1, 2, 3)).

This rule returns an Error for unquoted values that have 2 or more dots (e.g.: $version = [Version]1.2.3).
And implements a -Fix to surround the concerned violation with single quotes.

PR Checklist

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant