From 2914498adbf9b63477a0f82e86a0e094a310a17f Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 8 Sep 2026 20:25:39 +0100 Subject: [PATCH 1/5] Enforce semantic line breaks with Snapper --- .github/workflows/semantic-line-breaks.yml | 29 ++++++++++++++++++++++ docs/source/unreleased.rst | 4 +-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/semantic-line-breaks.yml diff --git a/.github/workflows/semantic-line-breaks.yml b/.github/workflows/semantic-line-breaks.yml new file mode 100644 index 00000000..16647cd2 --- /dev/null +++ b/.github/workflows/semantic-line-breaks.yml @@ -0,0 +1,29 @@ +name: Semantic line breaks + +on: + pull_request: + push: + branches: + - main + +permissions: {} + +jobs: + semantic-line-breaks: + name: Snapper + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + - name: Check semantic line breaks + run: >- + git ls-files -z -- '*.md' '*.rst' ':(exclude)vendored/**' + | xargs -0 --no-run-if-empty + uvx + --from + 'git+https://github.com/TurtleTech-ehf/snapper.git@bcd3458e27e4156ce4e0a0b55a227400328fb3b1' + snapper --max-width 0 --check + diff --git a/docs/source/unreleased.rst b/docs/source/unreleased.rst index 22ac7472..d297d197 100644 --- a/docs/source/unreleased.rst +++ b/docs/source/unreleased.rst @@ -1,8 +1,8 @@ Unreleased changes ================== -Changes that have landed on the main branch but are not yet part of a -tagged release. These entries are assembled into the +Changes that have landed on the main branch but are not yet part of a tagged release. +These entries are assembled into the :doc:`changelog` when the next release is published. .. towncrier-draft-entries:: From 8e2ce57f5b2cf39e6360c05168ebb7f06ca7043d Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 8 Sep 2026 21:05:47 +0100 Subject: [PATCH 2/5] Normalize Snapper configuration --- .github/workflows/semantic-line-breaks.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/semantic-line-breaks.yml b/.github/workflows/semantic-line-breaks.yml index 16647cd2..5c44124e 100644 --- a/.github/workflows/semantic-line-breaks.yml +++ b/.github/workflows/semantic-line-breaks.yml @@ -26,4 +26,3 @@ jobs: --from 'git+https://github.com/TurtleTech-ehf/snapper.git@bcd3458e27e4156ce4e0a0b55a227400328fb3b1' snapper --max-width 0 --check - From 167a75612c1541977516a2ad9e994f7c756a4086 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 8 Sep 2026 21:33:43 +0100 Subject: [PATCH 3/5] Enable Snapper Vale rules --- .vale.ini | 3 ++- styles/snapper/LongProseLine.yml | 11 +++++++++++ styles/snapper/SemanticLineBreaks.yml | 11 +++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 styles/snapper/LongProseLine.yml create mode 100644 styles/snapper/SemanticLineBreaks.yml diff --git a/.vale.ini b/.vale.ini index e502c137..68e95e9b 100644 --- a/.vale.ini +++ b/.vale.ini @@ -4,7 +4,8 @@ MinAlertLevel = error Packages = https://github.com/tbhb/vale-ai-tells/releases/download/v1.29.0/ai-tells.zip [*.{rst,md}] -BasedOnStyles = ai-tells +BasedOnStyles = ai-tells, snapper +snapper.SemanticLineBreaks = error # These rules misclassify established technical, example, or release-note prose # in this repository. All other ai-tells rules remain enforced. diff --git a/styles/snapper/LongProseLine.yml b/styles/snapper/LongProseLine.yml new file mode 100644 index 00000000..1f5029f7 --- /dev/null +++ b/styles/snapper/LongProseLine.yml @@ -0,0 +1,11 @@ +--- +# Vale style rule: flag prose lines that are suspiciously long. +# Likely indicates wrapped text that should use semantic line breaks. +extends: existence +message: Prose line exceeds 120 characters. Consider running 'snapper' to break at + sentence boundaries. +level: suggestion +scope: paragraph +# This catches lines > 120 chars that contain a period followed by a space. +# Pure code or URLs are less likely to match. +tokens: ['.{120,}'] diff --git a/styles/snapper/SemanticLineBreaks.yml b/styles/snapper/SemanticLineBreaks.yml new file mode 100644 index 00000000..3f4edaf5 --- /dev/null +++ b/styles/snapper/SemanticLineBreaks.yml @@ -0,0 +1,11 @@ +--- +# Vale style rule: flag lines containing multiple sentences. +# These should be broken at sentence boundaries. +extends: existence +message: Line contains multiple sentences. Run 'snapper --check' or reformat with + 'snapper --in-place'. +level: warning +scope: paragraph +# Match a sentence-ending punctuation followed by a space and a capital letter +# on the same line (indicating two sentences on one line). +tokens: ['[.!?]\\s+[A-Z]'] From ed3c5d8e507db95d58cf20e467015118a421fa36 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 8 Sep 2026 21:42:48 +0100 Subject: [PATCH 4/5] Format the Snapper workflow --- .github/workflows/semantic-line-breaks.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/semantic-line-breaks.yml b/.github/workflows/semantic-line-breaks.yml index 5c44124e..5d07b02d 100644 --- a/.github/workflows/semantic-line-breaks.yml +++ b/.github/workflows/semantic-line-breaks.yml @@ -1,10 +1,10 @@ +--- name: Semantic line breaks on: pull_request: push: - branches: - - main + branches: [main] permissions: {} @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - name: Check semantic line breaks run: >- git ls-files -z -- '*.md' '*.rst' ':(exclude)vendored/**' From 816f113cbb70f74d575e870d25603ebf478a17f6 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 8 Sep 2026 21:57:20 +0100 Subject: [PATCH 5/5] Use the Snapper 0.11.0 release --- .github/workflows/semantic-line-breaks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/semantic-line-breaks.yml b/.github/workflows/semantic-line-breaks.yml index 5d07b02d..d6cc0a0c 100644 --- a/.github/workflows/semantic-line-breaks.yml +++ b/.github/workflows/semantic-line-breaks.yml @@ -24,5 +24,5 @@ jobs: | xargs -0 --no-run-if-empty uvx --from - 'git+https://github.com/TurtleTech-ehf/snapper.git@bcd3458e27e4156ce4e0a0b55a227400328fb3b1' + 'snapper-fmt==0.11.0' snapper --max-width 0 --check