Azure / azure-sdk-tools

Tools repository leveraged by the Azure SDK team.
MIT License
112 stars 177 forks source link

CSpell Script Path Resolution can fail on Existing Files #5679

Open alzimmermsft opened 1 year ago

alzimmermsft commented 1 year ago

While regenerating session-records in the Java repository during migration to use Test Proxy I found that path resolution in the CSpell checking script was failing on files that do exist.

image

These path resolution failures do not cause the script to fail, the script will only fail if there are spelling errors. In the case of my PR all files failing path resolution fortunately would be ignored by CSpell as they are excluded, though I don't know if this can be guaranteed. A possible reason for this issue is that Java session-records include multiple .s in the last file segment and may include [ and ] if the test is parameterized. Reviewing documentation of Resolve-Path, what is being used in the script to perform path resolution, it may be a case where these characters are being treated as path regular expressions.

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/resolve-path?view=powershell-7.3#example-6-resolve-a-path-containing-brackets

danieljurek commented 3 weeks ago

Upshot: use

Resolve-Path -LiteralPath 'file[withbrackets].ext'