import WorkspaceConfiguration .product(name: "WorkspaceConfiguration", package: "Workspace")
Case

unicode

Prohibits typewriter workarounds when proper Unicode characters are available.

Declaration

case unicode

Discussion

This rule still permits most uses where the proper characters would not work:

print("Hello, world!") // ← Allowed, because quotation marks cannot be used instead.

In some contexts, such as when creating aliases, marked exemptions may be necessary:

func (a: Any, b: Any) -> Bool { return a != b // @exempt(from: unicode) }

This rule covers:

  • Horizontal strokes:

    • Hyphens: ‘twenty‐one’ (U+2010) instead of ‘twenty-one’ (U+002D).

    • Minus signs: ‘3 − 1 = 2’ (U+2212) instead of ‘3 - 1 = 2’ (U+002D).

    • Dashes: ‘—’ instead of ‘--’.

    • Bullets: ‘•’ instead of ‘-’.

    • Range symbols: ‘Dec. 3–5’ (U+2013) instead of ‘Dec. 3-5’ (U+002D).

  • Raised marks:

    • Quotation marks: ‘... “...” ...’ (U+2018–U+201F) instead of '... "..." ...'; (U+0022, U+0027).

    • Apostrophes: ‘it’s’ (U+2019) instead of ‘it's’ (U+0027).

    • Degrees symbols: ‘20°C’ instead of ‘20'C’.

    • Prime symbols: 5′6′′ (U+2032) instead of 5'6" (U+0027, U+0022).

  • ‘ב instead of ‘*’.

  • ‘÷‘ instead of ‘/‘.

  • ‘≠‘ instead of ‘!=‘.

  • ‘≤‘ instead of ‘<=‘.

  • ‘≥‘ instead of ‘>=‘.

  • ‘¬‘ instead of ‘!‘.

  • ‘∧‘ instead of ‘&&‘.

  • ‘∨‘ instead of ‘||‘.

macOS CentOS Ubuntu Amazon Linux