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

@ -57,6 +57,7 @@ console_scripts =
no-commit-to-branch = pre_commit_hooks.no_commit_to_branch:main
pre-commit-hooks-removed = pre_commit_hooks.removed:main
pretty-format-json = pre_commit_hooks.pretty_format_json:main
remove-em-dash = pre_commit_hooks.remove_em_dash:main
requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:main
sort-simple-yaml = pre_commit_hooks.sort_simple_yaml:main
trailing-whitespace-fixer = pre_commit_hooks.trailing_whitespace_fixer:main