Skip to content

Conversation

@jclarkeSTFC
Copy link
Contributor

This adds a workflow to run prek on a PR. prek is a Rust version of pre-commit, see here.

It will run all the hooks in the existing .pre-commit-config.yaml file.

If it has produced fixes, then those are committed to the PR branch.

Once this is in we can delete the pre-commit job.

To test:

This is a PR on my fork where you can see me making a formatting change and prek fixing it, jclarkeSTFC#2


Reviewer

Your comments will be used as part of the gatekeeper process. Comment clearly on what you have checked and tested during your review. Provide an audit trail for any changes requested.

As per the review guidelines:

  • Is the code of an acceptable quality? (Code standards/GUI standards)
  • Has a thorough functional test been performed? Do the changes handle unexpected input/situations?
  • Are appropriately scoped unit and/or system tests provided?
  • Do the release notes conform to the guidelines and describe the changes appropriately?
  • Has the relevant (user and developer) documentation been added/updated?
  • If the PR author isn’t in the mantid-developers or mantid-contributors teams, add a review comment rerun ci to authorize/rerun the CI

Gatekeeper

As per the gatekeeping guidelines:

  • Has a thorough first line review been conducted, including functional testing?
  • At a high-level, is the code quality sufficient?
  • Are the base, milestone and labels correct?

jclarkeSTFC and others added 6 commits November 14, 2025 14:00
This action installs prek and runs `prek run --all-files` on the
repository.
Removed space between elements in the return statement of getSpherical method.
@jclarkeSTFC jclarkeSTFC added this to the Release 6.15 milestone Nov 14, 2025
@jclarkeSTFC jclarkeSTFC added the DevOps Issues and pull requests related to DevOps label Nov 14, 2025
@jclarkeSTFC jclarkeSTFC reopened this Nov 14, 2025
@jclarkeSTFC jclarkeSTFC marked this pull request as ready for review November 14, 2025 15:58
Copy link
Contributor

@jhaigh0 jhaigh0 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Are we going to replace this locally somehow too?

@jclarkeSTFC
Copy link
Contributor Author

Yeah I'd suggest swapping out pre-commit for prek in the mantid-developer recipe, allegedly it's a drop-in replacement. I'm not sure if we actually want to merge this PR though, it was a bit of a test/demo, but I think it works fine if we decide to swap.

@thomashampson what do you think?

@jhaigh0 jhaigh0 self-assigned this Nov 17, 2025
@sf1919
Copy link
Contributor

sf1919 commented Nov 19, 2025

I think this is probably one for the next TWG.... @peterfpeterson ?

@thomashampson
Copy link
Contributor

Where the current pre-commit PR job configured?

@peterfpeterson
Copy link
Member

@thomashampson got to https://pre-commit.ci/, login, and enable/disable the repository. Otherwise, the configuration itself is at the top of .pre-commit-config.yaml

$ head ~/code/mantid/.pre-commit-config.yaml 
default_language_version:
  python: python3

exclude: ^$|instrument/

ci:
  autofix_prs: true

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

Labels

DevOps Issues and pull requests related to DevOps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants