hauntsaninja / no_implicit_optional

A codemod to make your implicit optional type hints PEP 484 compliant.
MIT License
79 stars 8 forks source link

create a pre-commit hook #16

Closed alex-rakowski closed 11 months ago

alex-rakowski commented 11 months ago

This would be great to have as a pre-commit hook. I've forked the repo and have it working, but it would be better to come from the main repo rather than me keeping mine in sync with this.

you can test this pre-commit by adding this to your pre-commit-config.yaml:

  -   repo: https://github.com/alex-rakowski/no_implicit_optional # This will change to this repo
      # rev: 0.1.5
      rev: 8147e918d73b2c26280e40fdb0106011daad91de # from a particular commit
      hooks:
      -   id: no_implicit_optional_checker

To use a specified version rather than a commit hash, it would need tagged releases.

I can PR in the changes if there's interest in your end

hauntsaninja commented 11 months ago

Sure, I'd accept a pull request for this. In case it's useful, also note that ruff gained the ability to perform this check (RUF013).

alex-rakowski commented 11 months ago

Submitted a PR #17. It needs a tagged release of the main repo 0.1.4 to work.

Thanks for the heads up on the Ruff rule set; I stumbled across it shortly after I worked out how to make the hook.