Add remove-em-dash hook

New fixer hook that replaces UTF-8 em-dashes (U+2014) with a plain
hyphen (-), modeled on the trailing-whitespace hook.

- pre_commit_hooks/remove_em_dash.py: the fixer (binary-safe, UTF-8 only)
- tests/remove_em_dash_test.py: full coverage of fix and no-op cases
- registered in setup.cfg, .pre-commit-hooks.yaml, and README.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub J Jablonski 2026-06-24 17:12:13 +02:00
parent fa6b006f0e
commit aba8a7597a
No known key found for this signature in database
5 changed files with 84 additions and 0 deletions

View file

@ -175,6 +175,11 @@ the following commandline options:
- `--no-sort-keys` - when autofixing, retain the original key ordering (instead of sorting the keys)
- `--top-keys comma,separated,keys` - Keys to keep at the top of mappings.
#### `remove-em-dash`
Replaces em-dashes (Unicode `U+2014`) with a plain hyphen (`-`).
- Only the UTF-8 encoding of the em-dash is replaced; files using other
encodings are left untouched.
#### `requirements-txt-fixer`
Sorts entries in requirements.txt and constraints.txt and removes incorrect entry for `pkg-resources==0.0.0`