Skip to content

.pre-commit-config.yaml → prek.toml - #648

Open
samcunliffe wants to merge 3 commits into
mainfrom
sc/prek-dot-toml
Open

samcunliffe wants to merge 3 commits into
mainfrom
sc/prek-dot-toml

Conversation

@samcunliffe

@samcunliffe samcunliffe commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Follows on from

Replace the pre-commit-config files, since it's a bit confusing to have a config file named after a legacy tool.

@samcunliffe
samcunliffe marked this pull request as draft October 6, 2026 12:03
Comment thread prek.toml
@samcunliffe
samcunliffe force-pushed the sc/prek-dot-toml branch 2 times, most recently from 49838b9 to 7e71560 Compare October 7, 2026 08:55
@samcunliffe
samcunliffe marked this pull request as ready for review October 7, 2026 09:12
@samcunliffe
samcunliffe requested review from paddyroddy and a balanced review from Copilot October 7, 2026 09:12

This comment was marked as resolved.

@samcunliffe
samcunliffe marked this pull request as draft October 7, 2026 12:46
@samcunliffe
samcunliffe removed the request for review from paddyroddy October 7, 2026 12:46
@samcunliffe
samcunliffe requested a balanced review from Copilot October 7, 2026 14:00
@samcunliffe samcunliffe self-assigned this Oct 7, 2026
@samcunliffe samcunliffe added enhancement New feature or request p4-low Low priority and removed p4-low Low priority labels Oct 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The migration is complete, references are updated, and the new TOML configurations parse successfully.

Review effort: Balanced
Findings: None

Resolved since last review (5)

Toml sort prek itself. Fix some docs.
Add prek (and other) badges.
Comment thread docs/pages/linting.md

See
[here for an example configuration](https://github.com/UCL-ARC/python-tooling/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/.pre-commit-config.yaml)
[here for an example configuration](https://github.com/UCL-ARC/python-tooling/blob/main/%7B%7Bcookiecutter.project_slug%7D%7D/prek.toml)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The link checker will fail until this PR is merged, because this file doesn't exist on main.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's okay, as an admin you should be able to bypass (pending review).

@samcunliffe
samcunliffe marked this pull request as ready for review October 7, 2026 14:06
@samcunliffe

Copy link
Copy Markdown
Member Author

Hope you didn't get excessive notifications for this @paddyroddy. 🫠 I had some embarrassing fails because of the regression test data.

@samcunliffe
samcunliffe requested review from a team and paddyroddy October 7, 2026 14:07
@paddyroddy

Copy link
Copy Markdown
Member

Hope you didn't get excessive notifications for this @paddyroddy. 🫠 I had some embarrassing fails because of the regression test data.

It's okay, it all gets nicely threaded in Outlook anyway.

Comment thread prek.toml
Comment thread prek.toml

exclude = "^{{cookiecutter.project_slug}}/|^tests/data/test_package_generation/"

[[repos]]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Such a shame it's this syntax, quite ugly I think. But not that surprising.

I really like in a pyproject.toml having, e.g. one [project], one [dependency-groups], each [tool.<x>] having it's own section. Never really got the [[<x>]] format.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also means toml-sort has nothing to sort as they're all called [[repos]]

Comment thread prek.toml
Comment on lines +3 to +6
[[repos]]
hooks = [{id = "ruff-check"}, {id = "ruff-format"}]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.15.19"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think syntax would be so nice. Doesn't seem possible to automate with toml-sort at the moment though. trailing_comma_inline_array only works on arrays 😢 maybe we should raise an issue?

Suggested change
[[repos]]
hooks = [{id = "ruff-check"}, {id = "ruff-format"}]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.15.19"
[[repos]]
hooks = [
{id = "ruff-check"},
{id = "ruff-format"},
]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.15.19"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some of this might help when TOML 1.1.0 makes it's way into Python glass-dev/glass#1199.

Comment on lines +41 to +49
{args = [
"--fix=lf",
], id = "mixed-line-ending"},
{id = "check-case-conflict"},
{id = "check-docstring-first"},
{id = "check-merge-conflict"},
{id = "check-toml"},
{id = "end-of-file-fixer"},
{id = "trailing-whitespace"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Like something about this format is odd. It's nicer than YAML, but quite as nice as it could be.

Comment on lines +56 to +59
{args = [
"--schemafile=.github/schemas/github-issue-forms.json",
"--verbose",
], exclude = '^\.github/ISSUE_TEMPLATE/config\.yml$', files = '^\.github/ISSUE_TEMPLATE/.*\.yml$', id = "check-jsonschema", name = "Validate GitHub issue templates"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah this is the downside of TOML... Strings

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants