Skip to content

pre-commit-related updates#1345

Open
alexdewar wants to merge 4 commits into
mainfrom
pre-commit-updates
Open

pre-commit-related updates#1345
alexdewar wants to merge 4 commits into
mainfrom
pre-commit-updates

Conversation

@alexdewar

Copy link
Copy Markdown
Member

Description

A few small pre-commit-related changes:

  • Remove unneeded nbstripout hook
  • Update URL for cffconvert hook
  • Signpost prek as an alternative to pre-commit in docs

I toyed with doing #582 and also adding a hook for mdformat while I was at it, but the alternative YAML formatter ended up fighting with another hook and mdformat was making more changes to the md files than I was comfortable with (not sure if mdbook's slightly weird equation handling might be broken by it), so I left these for now.

Unrelated change:

  • Remove stray asterisk in docs

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

Copilot AI review requested due to automatic review settings June 12, 2026 14:12
@alexdewar alexdewar added this to MUSE Jun 12, 2026
@alexdewar alexdewar moved this to 👀 In review in MUSE Jun 12, 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.

Pull request overview

This PR makes small maintenance updates to the repository’s pre-commit setup and developer documentation, including removing an unused hook, updating a hook source URL, and documenting an alternative tooling option.

Changes:

  • Remove the nbstripout pre-commit hook from .pre-commit-config.yaml.
  • Update the cffconvert hook repository URL.
  • Update docs to mention prek as a pre-commit alternative and fix a small glossary typo.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/glossary.md Fixes formatting/typo in the “Commodity” definition.
docs/developer_guide/setup.md Documents prek as an alternative and adds the reference link.
.pre-commit-config.yaml Removes nbstripout and updates the cffconvert repo URL.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.54%. Comparing base (f75bc64) to head (44887f7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1345   +/-   ##
=======================================
  Coverage   89.54%   89.54%           
=======================================
  Files          58       58           
  Lines        8525     8525           
  Branches     8525     8525           
=======================================
  Hits         7634     7634           
  Misses        580      580           
  Partials      311      311           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .pre-commit-config.yaml
args: [--ignore-words, .codespell_ignore.txt]
exclude: \.svg$
- repo: https://github.com/EnergySystemsModellingLab/cffconvert
- repo: https://github.com/ImperialCollegeLondon/cffconvert

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we need to use a fork?

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.

It's a really annoying issue where there isn't a release for cffconvert which includes the pre-commit hooks. You can tell pre-commit to use a particular commit rather than a release, but pre-commit autoupdate fails in this case, preventing us from updating any of the pre-commit hooks. Should probably open an issue for pre-commit for it.

The fork doesn't have any new code, just a new release.

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.

...and I've now moved the fork to the ICL repo because we're using it for another project.

commit is made. You can run `pre-commit` via our `justfile`, provided you have `uv` installed.

Alternatively, you can use [prek], which aims to be a drop-in replacement for `pre-commit`. Being
written in Rust, it has no dependencies and can be installed with `cargo`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Interesting. Didn't know this existed. Wonder if it might be worth making this the default instruction, rather than two alternatives which might be confusing.

Could this have cleared up some of the issues Melissa was having with pre-commit, for example?

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.

Yeah, I'm wondering that too. I've been using it for all my projects for months now instead of pre-commit, without issue. It's probably easier to set up given that developers will have cargo anyway.

Melissa was actually able to get things working with prek in the end (we gave up on pre-commit).

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

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

3 participants