From e80ed3fee8e57e46d3e42183e5f089c9f627c8eb Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:27:59 +0100 Subject: [PATCH 1/4] Bumped pre-commit hook versions and fixed failures --- .pre-commit-config.yaml | 4 ++-- docs/source/extensions/concourse.py | 2 +- docs/source/extensions/linecount.py | 2 +- docs/source/extensions/wikipedia.py | 2 +- docs/source/extensions/xkcd.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4194343..8117767 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: check-added-large-files args: [--enforce-all, --maxkb=100] - repo: https://github.com/google/yamlfmt - rev: v0.16.0 + rev: v0.17.0 hooks: - id: yamlfmt - repo: https://github.com/hhatto/autopep8 @@ -55,7 +55,7 @@ repos: - id: pyroma args: ["-d", "--min=10", "."] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.16.0 hooks: - id: mypy additional_dependencies: ["types-docutils", "types-python-dateutil", "types-requests"] diff --git a/docs/source/extensions/concourse.py b/docs/source/extensions/concourse.py index 45cda9d..6ef594b 100644 --- a/docs/source/extensions/concourse.py +++ b/docs/source/extensions/concourse.py @@ -44,7 +44,7 @@ def make_concourse_link(name: str, rawtext: str, text: str, lineno: int, inliner :return: A list containing the created node, and a list containing any messages generated during the function. """ - text = nodes.unescape(text) # type: ignore[attr-defined] + text = nodes.unescape(text) _, title, target = split_explicit_title(text) title = title.split(".")[-1].replace("-", " ") diff --git a/docs/source/extensions/linecount.py b/docs/source/extensions/linecount.py index a541cc1..e3c0e58 100644 --- a/docs/source/extensions/linecount.py +++ b/docs/source/extensions/linecount.py @@ -38,7 +38,7 @@ def count_lines(name: str, rawtext: str, text: str, lineno: int, inliner: Inline :return: A list containing the created node, and a list containing any messages generated during the function. """ - path = Path(nodes.unescape(text)) # type: ignore[attr-defined] + path = Path(nodes.unescape(text)) page_path = Path(Path(inliner.document.settings._source)) resolved_path = (page_path.parent / path).resolve() with open(resolved_path) as rf: diff --git a/docs/source/extensions/wikipedia.py b/docs/source/extensions/wikipedia.py index 90aed1c..72ac24f 100644 --- a/docs/source/extensions/wikipedia.py +++ b/docs/source/extensions/wikipedia.py @@ -44,7 +44,7 @@ def make_wikipedia_link(name: str, rawtext: str, text: str, lineno: int, inliner :return: A list containing the created node, and a list containing any messages generated during the function. """ - text = nodes.unescape(text) # type: ignore[attr-defined] + text = nodes.unescape(text) has_explicit, title, target = split_explicit_title(text) if (match := RE_WIKI_LANG.match(target)): diff --git a/docs/source/extensions/xkcd.py b/docs/source/extensions/xkcd.py index 6810e24..af09398 100644 --- a/docs/source/extensions/xkcd.py +++ b/docs/source/extensions/xkcd.py @@ -117,7 +117,7 @@ def make_xkcd_link(name: str, rawtext: str, text: str, lineno: int, inliner: Inl :return: A list containing the created node, and a list containing any messages generated during the function. """ - text = nodes.unescape(text) # type: ignore[attr-defined] + text = nodes.unescape(text) _, title, target = split_explicit_title(text) endpoint: str = inliner.document.settings.env.config.xkcd_endpoint From 1b4cc28df5ec8cd75c35d18b9c466199a0cfaa85 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:33:24 +0100 Subject: [PATCH 2/4] Added 'check-github-workflows' pre-commit hook --- .github/workflows/documentation.yaml | 2 -- .github/workflows/pre-commit.yaml | 2 -- .pre-commit-config.yaml | 4 ++++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index 12787e3..db6c508 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -5,8 +5,6 @@ on: jobs: build: runs-on: ubuntu-latest - strategy: - fail-fast: false steps: - uses: actions/checkout@v3 - name: Set up Python 3.12 diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 9cc8e83..80faf1a 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -5,8 +5,6 @@ on: jobs: build: runs-on: ubuntu-latest - strategy: - fail-fast: false steps: - uses: actions/checkout@v3 - name: Set up Python 3.12 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8117767..bc18eae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,6 +59,10 @@ repos: hooks: - id: mypy additional_dependencies: ["types-docutils", "types-python-dateutil", "types-requests"] + - repo: "https://github.com/python-jsonschema/check-jsonschema" + rev: "0.33.0" + hooks: + - id: check-github-workflows - repo: https://github.com/johannsdg/pre-commit-license-headers rev: d53087d331942f263cb553dc67b0e51ffa3a3481 hooks: From 97dc5f5de397da1ba5785e82b1c7a3f6d8d3e6d0 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Mon, 2 Jun 2025 09:33:59 +0100 Subject: [PATCH 3/4] Pre-commit workflow now forces coloured output --- .github/workflows/pre-commit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 80faf1a..1867bf1 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -17,4 +17,4 @@ jobs: python -m pip install pre-commit - name: Run pre-commit checks run: | - python -m pre_commit run --all-files + python -m pre_commit run --all-files --color always From 00f9541aff53b491973e00ae4cbcecaf423341e4 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Mon, 2 Jun 2025 10:23:12 +0100 Subject: [PATCH 4/4] Fixed the test version of 'concourse/mock-resource to 0.13.0 --- .github/workflows/unit-tests.yaml | 2 +- tests/test_resource.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 0623ed5..1cf0f0b 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -17,7 +17,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Pull docker image run: | - docker pull concourse/mock-resource:latest + docker pull concourse/mock-resource:0.13.0 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/tests/test_resource.py b/tests/test_resource.py index 1c79520..e0e04ec 100644 --- a/tests/test_resource.py +++ b/tests/test_resource.py @@ -736,7 +736,7 @@ def _build_test_resource_docker_image() -> str: class ExternalDockerWrapperTests(TestCase): - image = "concourse/mock-resource" + image = "concourse/mock-resource:0.13.0" @classmethod def setUpClass(cls) -> None: @@ -923,7 +923,7 @@ def _format_debugging_message(message: str) -> str: class ExternalDockerConversionWrapperTests(TestCase): - image = "concourse/mock-resource" + image = "concourse/mock-resource:0.13.0" @classmethod def setUpClass(cls) -> None: