Skip to content

discrepancy between local pre-commit and CI's codeformat #8683

Description

@Borda

I’ve noticed that the current CI linting process sometimes diverges from the local pre-commit configuration, 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-commit configuration. By running pre-commit directly 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

Activity

  1. ericspod commented on Jan 13, 2026

    @ericspod
    Member

    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!

  2. Borda commented on Jan 13, 2026

    @Borda
    ContributorAuthor

    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!

    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)

  3. Borda commented on Jan 13, 2026

    @Borda
    ContributorAuthor

    to keep track:

  4. aymuos15 commented on Mar 18, 2026

    @aymuos15
    Contributor

    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.

  5. ericspod commented on Mar 30, 2026

    @ericspod
    Member

    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.yaml we 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 using runtests.sh. One idea I had was to use the pre-commit lite action to do these checks which would use runtests.sh to 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).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions