From d4515e4ad3eee6318744c64cf2eab0ea0b5b7562 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Mon, 3 Feb 2025 00:44:34 +0100 Subject: [PATCH] Fix a few PR links in the changelog (#18586) And add a local pre-commit hook to detect when a PR number in a link text is different from the link body --- .pre-commit-config.yaml | 8 ++++++++ CHANGELOG.md | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dc411c6da49b1..da5554bf2e321 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,14 @@ repos: rev: v1.0.1 hooks: - id: zizmor + - repo: local + hooks: + - id: bad-pr-link + name: Bad PR link + description: Detect PR links text that don't match their URL + language: pygrep + entry: '\[(\d+)\]\(https://github.com/python/mypy/pull/(?!\1/?\))\d+/?\)' + files: CHANGELOG.md # Should be the last one: - repo: meta hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3acec84fec5dc..bc3a0f83d907f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ By default, mypy treats an annotation of ``bytes`` as permitting ``bytearray`` a [PEP 688](https://peps.python.org/pep-0688) specified the removal of this special case. Use this flag to disable this behavior. `--strict-bytes` will be enabled by default in **mypy 2.0**. -Contributed by Ali Hamdan (PR [18137](https://github.com/python/mypy/pull/18263/)) and +Contributed by Ali Hamdan (PR [18263](https://github.com/python/mypy/pull/18263)) and Shantanu Jain (PR [13952](https://github.com/python/mypy/pull/13952)). ### Improvements to reachability analysis and partial type handling in loops @@ -36,7 +36,7 @@ issues it previously did not detect. In some cases, this change may require use explicit annotation of a variable. Contributed by Christoph Tyralla (PR [18180](https://github.com/python/mypy/pull/18180), -[PR](https://github.com/python/mypy/pull/18433)). +PR [18433](https://github.com/python/mypy/pull/18433)). (Speaking of partial types, another reminder that mypy plans on enabling `--local-partial-types` by default in **mypy 2.0**). @@ -49,7 +49,7 @@ configuration files. See the for more details. Contributed by Mikhail Shiryaev and Shantanu Jain -(PR [16965](https://github.com/python/mypy/pull/16965), PR [18482](https://github.com/python/mypy/pull/18482) +(PR [16965](https://github.com/python/mypy/pull/16965), PR [18482](https://github.com/python/mypy/pull/18482)) ### Better line numbers for decorators and slice expressions