Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document pre-commit #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,19 @@ Running this will check that your project adheres to the contracts you've define

lint-imports --verbose

Running using pre-commit
------------------------

``import-linter`` can run as a `pre-commit`_ hook by adding this section to your `.pre-commit-config.yaml` file:

.. code-block:: yaml

repos:
- repo: https://github.com/seddonym/import-linter
rev: v2.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I correct in thinking this should be the latest version of Import Linter?

It would be good if this could be pulled in dynamically somehow from the release variable defined in docs/conf.py. I tried to figure out how to do this for about ten minutes, not sure how easy this would be. How's your Sphinx?

hooks:
- id: import-linter

.. _namespace packages: https://docs.python.org/3/glossary.html#term-namespace-package
.. _portion: https://docs.python.org/3/glossary.html#term-portion
.. _portion: https://docs.python.org/3/glossary.html#term-portion
.. _pre-commit: https://pre-commit.com/index.html
Loading