diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 00000000..e892c38c --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,7 @@ +- id: autopep8 + name: autopep8 + description: A tool that automatically formats Python code to conform to the PEP 8 style guide. + entry: autopep8 + language: python + types: [python] + args: [-i] diff --git a/README.rst b/README.rst index a65dba1c..da66742a 100644 --- a/README.rst +++ b/README.rst @@ -384,6 +384,23 @@ configuration file example:: recursive = true aggressive = 3 +Usage with pre-commit +===================== + +autopep8 can be used as a hook for pre-commit_. + +To add autopep8 as a plugin, add this repo definition to your configuration: + +.. code-block:: yaml + + repos: + - repo: https://github.com/hhatto/autopep8 + rev: ... # select the tag or revision you want, or run `pre-commit autoupdate` + hooks: + - id: autopep8 + +.. _`pre-commit`: https://pre-commit.com + Testing =======