From 757f8daaa29bbedd5464135d24b46e5a80de802e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 16 May 2025 16:27:24 +0200 Subject: [PATCH] Add typos tool to pre-commit This tool corrects common misspellings in all kinds of text files. --- .pre-commit-config.yaml | 12 ++++++++++++ .typos.toml | 10 ++++++++++ CHANGELOG.rst | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .typos.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2eeadb3..d9dd6e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,18 @@ repos: - id: check-toml - id: end-of-file-fixer - id: trailing-whitespace +- repo: https://github.com/crate-ci/typos + rev: 6cb49915af2e93e61f5f0d0a82216e28ad5c7c18 # frozen: v1 + hooks: + - id: typos + exclude: | + (?x)^( + .*\.min\.css + |.*\.min\.js + |.*\.css\.map + |.*\.js\.map + |.*\.svg + )$ - repo: https://github.com/tox-dev/pyproject-fmt rev: 57b6ff7bf72affdd12c7f3fd6de761ba18a33b3a # frozen: v2.5.1 hooks: diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..7f1d007 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,10 @@ +# Configuration file for 'typos' tool +# https://github.com/crate-ci/typos + +[default] +extend-ignore-re = [ + # Single line ignore comments + "(?Rm)^.*(#|//)\\s*typos: ignore$", + # Multi-line ignore comments + "(?s)(#|//)\\s*typos: off.*?\\n\\s*(#|//)\\s*typos: on" +] diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cb09d4c..bbed7ee 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -203,7 +203,7 @@ Changelog 1.2.2 (2017-11-03) ------------------ -* Fix collection to not sometimes crash when encoutering pytest ``Item``\s +* Fix collection to not sometimes crash when encountering pytest ``Item``\s without a module. 1.2.1 (2017-06-17)