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

@ -190,6 +190,14 @@
language: python
pass_filenames: false
always_run: true
- id: remove-em-dash
name: remove em-dash
description: replaces em-dashes with a plain hyphen.
entry: remove-em-dash
language: python
types: [text]
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0
- id: requirements-txt-fixer
name: fix requirements.txt
description: sorts entries in requirements.txt.