Measure-GremlinCharacter: detect U+2011/U+2012/U+2014 dash gremlins - #14
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The rule, tests, and documentation changes are consistent with existing behavior and correctly extend detection and coverage for the added Unicode dash characters.
Pull request overview
This pull request extends the Measure-GremlinCharacter PSScriptAnalyzer custom rule to detect three additional dash-like Unicode “gremlin” characters (U+2011 non-breaking hyphen, U+2012 figure dash, U+2014 em dash), aligning their severity with existing punctuation-like gremlins and keeping the diagnostic message format consistent across detections.
Changes:
- Added U+2011/U+2012/U+2014 to the ordered gremlin map with
Warningseverity inMeasure-GremlinCharacter. - Expanded the table-driven Pester cases to assert detection/message/severity for the new characters.
- Updated the rule documentation to list the added dash-like characters under the
Warningseverity category.
File summaries
| File | Description |
|---|---|
| GoodEnoughRules/Public/Measure-GremlinCharacter.ps1 | Adds the three new dash code points to the gremlin lookup map with Warning severity. |
| tests/Measure-GremlinCharacter.tests.ps1 | Extends the parameterized test matrix to cover U+2011/U+2012/U+2014 end-to-end. |
| docs/en-US/Measure-GremlinCharacter.md | Updates the severity description text to include the newly-detected dash variants. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Test Results 4 files 56 suites 8s ⏱️ Results for commit 3e127d1. ♻️ This comment has been updated with latest results. |
Co-authored-by: HeyItsGilbert <615265+HeyItsGilbert@users.noreply.github.com>
b8581e4 to
3e127d1
Compare
Measure-GremlinCharactercurrently catches several deceptive Unicode punctuation characters but misses three dash variants that can silently alter script text. This update adds detection for em dash, figure dash, and non-breaking hyphen with the same warning posture used for nearby typographic punctuation.Rule updates
Measure-GremlinCharacter:U+2011— non-breaking hyphenU+2012— figure dashU+2014— em dashWarningseverity for all three to align with existing punctuation-like deceptive characters (e.g., en dash, curly quotes).Gremlin character found: U+XXXX (<description>). This character may be invisible or visually deceptive.Test coverage
tests/Measure-GremlinCharacter.tests.ps1to assert detection, message text, and severity forU+2011,U+2012, andU+2014.Documentation
docs/en-US/Measure-GremlinCharacter.mdseverity section to explicitly list the added dash-like typographic characters underWarning.