seddonym / import-linter

Import Linter allows you to define and enforce rules for the internal and external imports within your Python project.
https://import-linter.readthedocs.io/
BSD 2-Clause "Simplified" License
664 stars 45 forks source link

Add pre-commit documentation to docs #213

Open valentincalomme opened 7 months ago

valentincalomme commented 7 months ago

Hi! Love the package. I wanted to add it to my pre-commit hooks but realized there wasn't explicit documentation in the docs.

It would be nice to have a small section explaining how to add it to your hooks and use it with specific settings and parameters.

Happy to help contribute to that.

seddonym commented 7 months ago

Thank you!

I also use Import Linter with pre-commit. To be honest I'm not sure what specific instructions would be needed beyond whatever is documented in pre-commit, along with the running the linter section. Do you want to suggest some wording so I've got more of an idea what you're looking for?

valentincalomme commented 7 months ago

I don't think it needs much info indeed, but something like this could be added to the README.md or at the end of the running the linter section:

`import-linter` can also be used as a `pre-commit` hook. To do so, simply add this section to your `.pre-commit-config.yaml` file:

- repo: https://github.com/seddonym/import-linter/
    rev: "v2.0"
    hooks:
      - id: import-linter
        # any arguments from `lint-imports` can be added here
        args: ["--verbose"]

For the part with the args, I am not entirely certain it works.