Repository navigation
discrepancy between local pre-commit and CI's codeformat #8683
Description
Activity
Hi @Borda we always appreciate help on these things. If you wanted to put together what you propose as a PR we can look at it from there. I agree it would be good to regularise behaviours like this, and otherwise improve the CI pipelines. Thanks!
Reacted by Jirka BorovecHi @Borda we always appreciate help on these things. If you wanted to put together what you propose as a PR we can look at it from there. I agree it would be good to regularise behaviours like this, and otherwise improve the CI pipelines. Thanks!
Sure, I'll have a look... I think it'll be a multi-PR process, which would also include solidifying the linting, for example prune duplicated tools (since you already use Ruff, many other linting tools can be replaced by just enabling a rule with Ruff)
to keep track:
- completing replacing
flake8with Ruff by adding remaining/missing sules to have full parity in Complete replaceflake8withruffand update rules #8694 - replace
yesqaby Ruff'sRUF100in Replace yesqa hook from pre-commit configuration with Ruff's RUF100 #8692, which removes collision between raising error and dropping needednoqa
Reacted by Eric Kerfoot- completing replacing
I have tried (very mildly opinionated way) of approaching this (as I am facing difficulties while trying to do a PR) over here: https://github.com/aymuos15/MONAI/tree/fix/ci-lint-typing
The tldr is to remove evrything and only do ruff + certain ruff constraints based on current behaviour + mypy. It builds on top of @Borda 's work.
This also involves looking into https://github.com/Project-MONAI/monai-code-formatter
Tagging @theo-barfoot here as well.
Thanks @Borda and @aymuos15 for the discussion. I think it's better now, but I wonder if we still have an issue of tool versions as well.
With
.pre-commit-config.yamlwe can set some versions for ruff and other tools, but these may diverge from that in our requirements files and from what users would locally install when usingruntests.sh. One idea I had was to use the pre-commit lite action to do these checks which would useruntests.shto autofix code as well as run the other pre-commit hooks.I have a test repo demonstrating this here. Here there is only one requirements definition for the tools being used and one source of truth for how checks are done (through
runtests.sh).- added a commit that references this issue
on Sep 7, 2026
I’ve noticed that the current CI linting process sometimes diverges from the local
pre-commitconfiguration, leading to inconsistencies in tool versions and ignore patterns (as seen in this recent run).To ensure better parity between local development and CI, I suggest consolidating the linting steps to rely solely on the repository's
pre-commitconfiguration. By runningpre-commitdirectly in the CI pipeline, we can ensure that the exact same versions and rules are applied everywhere. This would simplify the contributor experience and make the linting results much more predictable.I am happy to help update the GitHub Action workflows to implement this consolidation if the team is open to the idea!
cc: @KumoLiu @ericspod