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

Add .pre-commit-hooks.yaml #298

Merged
merged 4 commits into from
Jul 31, 2023

Conversation

RomainTT
Copy link
Contributor

@RomainTT RomainTT commented Jul 19, 2023

pre-commit is a useful tool to run some programs while making a commit. If anything goes wrong or if a file changes, the commit is aborted.

It is very nice to have a pre-commit hook for pydoc-markdown, as it can ensure one does not commit code changes without updating the documentation (in case the documentation is a versioned file too).

Of course if you don't need to update documentation in your repository when your code change, you simply don't use that pre-commit hook.

RomainTT and others added 4 commits July 19, 2023 09:45
Add pass_filenames: false, because pydoc-markdown should not receive filenames as arguments
@NiklasRosenstein
Copy link
Owner

Hey @RomainTT , thanks for your contribution. I haven't used pre-commit yet; is this really all that's needed for another repository to use Pydoc-Markdown in their pre-commit config, including the installation of Pydoc-Markdown? 👀

@RomainTT
Copy link
Contributor Author

Hey @RomainTT , thanks for your contribution. I haven't used pre-commit yet; is this really all that's needed for another repository to use Pydoc-Markdown in their pre-commit config, including the installation of Pydoc-Markdown? 👀

Yes this is all that is needed. You can use it by creating a file .pre-commit-config.yaml in your repository, with the following content :

repos:
  - repo: https://github.com/NiklasRosenstein/pydoc-markdown
    rev: develop
    hooks:
      - id: pydoc-markdown

pre-commit will clone the repository and install the Python package in a virtual environment, so it can run pydoc-markdown when a commit is done with some python files in it.

@NiklasRosenstein NiklasRosenstein merged commit e2e1acd into NiklasRosenstein:develop Jul 31, 2023
8 checks passed
@NiklasRosenstein
Copy link
Owner

Thanks for the explanation, @RomainTT. Happy to merge this. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants