Skip to content

hygiene: permit additional unambiguous box-drawing characters#165665

Closed
rwe wants to merge 4 commits intomicrosoft:mainfrom
rwe:hygiene-allow-box-drawing
Closed

hygiene: permit additional unambiguous box-drawing characters#165665
rwe wants to merge 4 commits intomicrosoft:mainfrom
rwe:hygiene-allow-box-drawing

Conversation

@rwe
Copy link
Contributor

@rwe rwe commented Nov 6, 2022

This updates hygiene.js to permit additional box-drawing characters, beyond the very small set currently allowed (●◆▼┌└├).

The additional characters are shown below and are not confusable with ASCII letters (perhaps arguably , though it's very distinguishable in fonts I've seen), but are useful for diagramming.

The impetus to this was the unexpected lint failures of a couple of my PRs which included comment diagrams:

This additionally adds the double-stroke arrows (, , ) in a separate commit.

const [rangeMin, rangeMax] = [0x2500, 0x25FF];
console.log(Array(rangeMax - rangeMin + 1).fill(rangeMin)
  .map((c, i) => String.fromCharCode(c + i))
  .join(' ').replaceAll(/(.{32})/g, '$1\n'));
─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏
┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟
┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯
┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿
╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏
═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟
╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯
╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿
▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏
▐ ░ ▒ ▓ ▔ ▕ ▖ ▗ ▘ ▙ ▚ ▛ ▜ ▝ ▞ ▟
■ □ ▢ ▣ ▤ ▥ ▦ ▧ ▨ ▩ ▪ ▫ ▬ ▭ ▮ ▯
▰ ▱ ▲ △ ▴ ▵ ▶ ▷ ▸ ▹ ► ▻ ▼ ▽ ▾ ▿
◀ ◁ ◂ ◃ ◄ ◅ ◆ ◇ ◈ ◉ ◊ ○ ◌ ◍ ◎ ●
◐ ◑ ◒ ◓ ◔ ◕ ◖ ◗ ◘ ◙ ◚ ◛ ◜ ◝ ◞ ◟
◠ ◡ ◢ ◣ ◤ ◥ ◦ ◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ ◯
◰ ◱ ◲ ◳ ◴ ◵ ◶ ◷ ◸ ◹ ◺ ◻ ◼ ◽ ◾ ◿

rwe added 4 commits November 6, 2022 13:49
This does not alter the included ranges.
No functional change: just to clarify subsequent expansion.
This updates the "allowed" set ot include any of the box-drawing
characters, instead of a random assortment.

None of the characters in this range are similar to ASCII letters, with
the (perhaps)-arguable but exception of "╳".

> const [rangeMin, rangeMax] = [0x2500, 0x25FF];
> console.log(Array(rangeMax - rangeMin + 1).fill(rangeMin)
  .map((c, i) => String.fromCharCode(c + i))
  .join(' ').replaceAll(/(.{32})/g, '$1\n'));

 ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏
 ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟
 ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯
 ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿
 ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏
 ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟
 ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯
 ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿
 ▀ ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏
 ▐ ░ ▒ ▓ ▔ ▕ ▖ ▗ ▘ ▙ ▚ ▛ ▜ ▝ ▞ ▟
 ■ □ ▢ ▣ ▤ ▥ ▦ ▧ ▨ ▩ ▪ ▫ ▬ ▭ ▮ ▯
 ▰ ▱ ▲ △ ▴ ▵ ▶ ▷ ▸ ▹ ► ▻ ▼ ▽ ▾ ▿
 ◀ ◁ ◂ ◃ ◄ ◅ ◆ ◇ ◈ ◉ ◊ ○ ◌ ◍ ◎ ●
 ◐ ◑ ◒ ◓ ◔ ◕ ◖ ◗ ◘ ◙ ◚ ◛ ◜ ◝ ◞ ◟
 ◠ ◡ ◢ ◣ ◤ ◥ ◦ ◧ ◨ ◩ ◪ ◫ ◬ ◭ ◮ ◯
 ◰ ◱ ◲ ◳ ◴ ◵ ◶ ◷ ◸ ◹ ◺ ◻ ◼ ◽ ◾ ◿
@Tyriar
Copy link
Contributor

Tyriar commented Nov 8, 2022

@alexdima is there any concern with allowing box drawing, block element and geometric shape unicode characters?

@Tyriar Tyriar requested a review from alexdima November 8, 2022 16:53
@Tyriar Tyriar added this to the November 2022 milestone Nov 8, 2022
@alexdima
Copy link
Member

I am sorry for this inconvenience, but for security reasons we cannot accept this proposed relaxation in allowed characters in our source code. We understand that this is very annoying, as we cannot do diagrams in comments, but we receive daily tens of PRs from anonymous contributors and we cannot risk not being able to trust our eyes when doing PR review.

Here's an example of what would go bad given we would accept this PR:

const a = b─c; // <- this is an identifier `b─c` (─ is U+2500)
const a = b-c; // <- this is a subtraction between two identifiers `b` and `c` (- is U+002D)

This website can provide additional context: https://trojansource.codes/

@alexdima alexdima closed this Nov 11, 2022
@rwe
Copy link
Contributor Author

rwe commented Nov 14, 2022

Fair enough! I've updated those PRs to include ASCII-only diagrams.

@rwe rwe deleted the hygiene-allow-box-drawing branch November 14, 2022 21:33
@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants