All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 Check that the rev value in the example pre-commit configuration matches
3 the latest version of Black. This saves us from forgetting to update that
4 during the release process.
6 Why can't we just use `rev: stable` and call it a day? Well pre-commit
7 won't auto update the hook as you may expect (and for good reasons, some
8 technical and some pragmatic). Encouraging bad practice is also just
9 not ideal. xref: https://github.com/psf/black/issues/420
17 from bs4 import BeautifulSoup
20 def main(changes: str, source_version_control: str) -> None:
21 changes_html = commonmark.commonmark(changes)
22 changes_soup = BeautifulSoup(changes_html, "html.parser")
23 headers = changes_soup.find_all("h2")
25 header.string for header in headers if header.string != "Unreleased"
28 source_version_control_html = commonmark.commonmark(source_version_control)
29 source_version_control_soup = BeautifulSoup(
30 source_version_control_html, "html.parser"
32 pre_commit_repos = yaml.safe_load(
33 source_version_control_soup.find(class_="language-yaml").string
36 for repo in pre_commit_repos:
37 pre_commit_rev = repo["rev"]
38 if not pre_commit_rev == latest_tag:
40 "Please set the rev in ``source_version_control.md`` to be the latest "
41 f"one.\nExpected {latest_tag}, got {pre_commit_rev}.\n"
46 if __name__ == "__main__":
47 with open("CHANGES.md", encoding="utf-8") as fd:
50 os.path.join("docs", "integrations", "source_version_control.md"),
53 source_version_control = fd.read()
54 main(changes, source_version_control)