mutmut icon indicating copy to clipboard operation
mutmut copied to clipboard

[FEATURE] Any plans to make mutmut available as pre-commit hook?

Open icncsx opened this issue 3 years ago • 1 comments

The title is self-explanatory. I'm wondering, Anders, if mutmut can be available as a pre-commit hook.

icncsx avatar Apr 14 '21 21:04 icncsx

I think that's a bad idea. Mutmuts incremental mode isn't nearly solid enough for that to work well. It's better to think of mutation testing as something you do once in a while.

boxed avatar Apr 15 '21 04:04 boxed

If you want to run mutmut as a pre-commit hook you can write your own "system" hook. Here is an example of a pytest hook:

  - repo: local
    hooks:
      - id: run-pytest
        description: run pytest
        name: run pytest # displayed when hook is executed
        entry: python3
        args: [-m, pytest, processor/test]
        language: system
        types: [python]
        pass_filenames: false
        exclude:
            (?x)(
              ^.vscode/|
              ^Pipfile.lock$|
              ^external/ |
              ^scripts/
            )
        stages: [push]

drjasonharrison avatar Feb 06 '23 18:02 drjasonharrison

Have you tried that? Seems totally crazy to me. Mutmut is just WAY WAY too slow to run as a precommit hook.

boxed avatar Feb 06 '23 19:02 boxed

No I haven't tried that. Just offering a workaround so this issue can be closed.

drjasonharrison avatar Feb 06 '23 20:02 drjasonharrison

Honestly, I should have closed this as "huh what? doesn't make sense" :P

boxed avatar Feb 06 '23 20:02 boxed