Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
887e0e0
Add Vale for content linting to the repo
paddyroddy Jun 2, 2025
2a2348c
Move comment to bottom
paddyroddy Jun 2, 2025
b091a30
Update .github/styles/custom/endash.yml
paddyroddy Jun 2, 2025
a0e8d26
Update .vale.ini
paddyroddy Jun 2, 2025
ca5a045
Update .vale.ini
paddyroddy Jun 2, 2025
e32d217
Update .vale.ini
paddyroddy Jun 3, 2025
5293621
Change rules
paddyroddy Jun 3, 2025
77fd9a0
Update british-spellings.yml
paddyroddy Jun 3, 2025
915a6e8
Add gitignore
paddyroddy Jun 3, 2025
d83fe9b
Fix Vale sync issue
paddyroddy Jun 3, 2025
703f01e
Delete .github/styles/custom/british-spellings.yml
paddyroddy Jun 3, 2025
e1d5b39
Remove custom files
paddyroddy Jun 5, 2025
31dd235
Update gitignore
paddyroddy Jun 5, 2025
6fead66
Expand vale.ini
paddyroddy Jun 5, 2025
815e295
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 5, 2025
2076cd7
Revert changes
paddyroddy Jun 5, 2025
fa2ec11
Disable licence files
paddyroddy Jun 5, 2025
36ddf8c
Merge branch 'main' into vale
paddyroddy Jun 5, 2025
8539fe0
Remove RedHat
paddyroddy Jun 5, 2025
db62870
Remove RedHat properly
paddyroddy Jun 5, 2025
1f0983c
Try REVIEWDOG_GITHUB_API_TOKEN var
paddyroddy Jun 5, 2025
3d1617e
Revert "Try REVIEWDOG_GITHUB_API_TOKEN var"
paddyroddy Jun 5, 2025
a2af066
Change to `github-check`
paddyroddy Jun 5, 2025
f5201d8
Turn off error
paddyroddy Jun 5, 2025
7b25e03
Try github-pr-review again
paddyroddy Jun 5, 2025
808b1e7
Revert "Try github-pr-review again"
paddyroddy Jun 5, 2025
bf1841f
Remove quarto references
paddyroddy Jun 6, 2025
f8aad48
Genuine bug: "the the"
samcunliffe Jun 6, 2025
a20c799
Turn off rules for `> NOTE`
paddyroddy Jun 6, 2025
73fd5c1
Exclude all GitHub magic callouts
paddyroddy Jun 6, 2025
3adfd7b
Improve comment
paddyroddy Jun 6, 2025
f53e939
Exclude CODE_OF_CONDUCT
paddyroddy Jun 6, 2025
3748887
Use @matt-graham's regex
paddyroddy Jun 6, 2025
245674e
Revert markdown change
paddyroddy Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ jobs:
git add .
pre-commit run --all-files --color always --verbose
working-directory: cookie-template/python-template

lint-prose:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Run Vale
uses: errata-ai/vale-action@d89dee975228ae261d22c15adcd03578634d429c # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filter_mode: nofilter
reporter: github-check
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@
python-template

*.DS_Store

# https://vale.sh/docs/keys/packages#vcs
.github/styles/*
!.github/styles/config/
.github/styles/config/*
!.github/styles/config/vocabularies/
.github/styles/config/vocabularies/*
!.github/styles/config/vocabularies/Base
27 changes: 27 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
StylesPath = .github/styles

# https://github.com/errata-ai/packages
Packages = proselint,\
write-good

[*.md]
BasedOnStyles = proselint,\
Vale,\
write-good

# Disable
Vale.Spelling = NO
write-good.E-Prime = NO
write-good.Passive = NO
write-good.TooWordy = NO

# Ignore lines starting with "> [!NOTE]"
BlockIgnores = (?s)> \[!NOTE\].*?(\n|$)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replaces the inline comment before @matt-graham

Copy link
Member

@samcunliffe samcunliffe Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eeeeeh what about TIP IMPORTANT WARNING CAUTION? Do they get flagged.
I could imagine > [!TIP] is quite useful.

Suggested change
BlockIgnores = (?s)> \[!NOTE\].*?(\n|$)
BlockIgnores = (?s)> \[!(CAUTION|IMPORTANT|NOTE|TIP|WARNING)\].*?(\n|$)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they would be

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah so it was the > ![NOTE] alert syntax specifically that was triggering not the content of the alert? I guess we could also include the other alert types here (!TIP, !IMPORTANT, !WARNING, !CAUTION). I don't entirely understand the regex here - it looks like Value uses regexp2 which is based on Go regexp, but after reading the docs I'm still entirely sure what (?s) bit is doing here (appears to be setting a flag to let . match \n but not sure why this is needed and whether it applies just to the group?). I think something like

^ *> \[!(NOTE|IMPORTANT|WARNING|CAUTION|TIP)\] *$

would avoid unintentionally capturing other characters with . while still allowing for white space before or after alert syntax (could also use \w in place of but not sure we actually want to allow for other white space types).

Copy link
Collaborator

@matt-graham matt-graham Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just spotted that you've already covered all altert types in last commit 73fd5c1 - I still don't entirely understand the regex but it works so marking as resolved! (EDIT: I hadn't refreshed before commenting so hadn't seem Sam's comment either).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I assume you meant \s in place of ? Hadn't occurred to me that \s was any type of whitespace. This is just in this flavour of regex? I've always taken it to mean strictly .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah bad news, yours doesn't work

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in the example linked to in the docs there it looks like it's excluding the whole block {< file } delimited block. Are we trying to similarly ignore the context of callouts or just the syntax which starts an alert? From https://regex101.com/r/rvRsMy/1 it looks like we just match the initial bit not the content. If so I think the regex I suggested will do so as well but is tighter / less chance for false matches

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went with (?s)> \[!(CAUTION|IMPORTANT|NOTE|TIP|WARNING)\](\n|$) and tested on regex101

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we want to just ignore the top line itself, not the contents within it. Your regex doesn't work, feel free to try it yourself locally (run vale sync; vale .)


# `vale sync` in CI means the packages are then linted, so turn them off
[.github/styles/**]
BasedOnStyles =

# Don't modify licence files
[**/LICENSE*]
BasedOnStyles =
2 changes: 1 addition & 1 deletion tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## ⚙️ Setting up dependencies for using template

<details><summary>Click to expand... </summary> <!-- markdownlint-disable-line MD033 -->

Check failure on line 10 in tutorial.md

View workflow job for this annotation

GitHub Actions / vale

[vale] tutorial.md#L10

[proselint.Typography] Consider using the '…' symbol instead of '...'.
Raw output
{"message": "[proselint.Typography] Consider using the '…' symbol instead of '...'.", "location": {"path": "tutorial.md", "range": {"start": {"line": 10, "column": 34}}}, "severity": "ERROR"}

To use the template you will need to install the following software tools

Expand Down Expand Up @@ -198,7 +198,7 @@

It is recommended to set up a project-specific [virtual environment](https://docs.python.org/3/tutorial/venv.html) whenever working on Python project. This allows you to install the versions of third-party packages the project requires without conflicting with the requirements of other projects you are developing.

There are a variety of virtual environment management tools available for Python. One option is [uv](https://docs.astral.sh/uv), which you will have installed if you followed our detailed set-up instructions above, or may already have installed previously. `uv` is an extremely fast Python package and virtual environment manager that has API compatiblility with `pip` and the built-in virtual environment manager - [`venv`](https://docs.python.org/3/library/venv.html).

Check failure on line 201 in tutorial.md

View workflow job for this annotation

GitHub Actions / vale

[vale] tutorial.md#L201

[write-good.ThereIs] Don't start a sentence with 'There are'.
Raw output
{"message": "[write-good.ThereIs] Don't start a sentence with 'There are'.", "location": {"path": "tutorial.md", "range": {"start": {"line": 201, "column": 1}}}, "severity": "ERROR"}

Check warning on line 201 in tutorial.md

View workflow job for this annotation

GitHub Actions / vale

[vale] tutorial.md#L201

[write-good.Weasel] 'extremely' is a weasel word!
Raw output
{"message": "[write-good.Weasel] 'extremely' is a weasel word!", "location": {"path": "tutorial.md", "range": {"start": {"line": 201, "column": 269}}}, "severity": "WARNING"}

Once you are in your `{project_slug}` directory, a virtual environment can be created by running the following in a terminal/command prompt window

Expand Down Expand Up @@ -270,7 +270,7 @@
python -m pip install --upgrade pip
```

Similar to `uv`, once the the environment is active, you can install the package in editable mode, along with both its required dependencies and optional sets of dependencies by running
Similar to `uv`, once the environment is active, you can install the package in editable mode, along with both its required dependencies and optional sets of dependencies by running

```sh
python -m pip install --editable ".[dev,docs,test]"
Expand Down
Loading