From 3c1e0e4e42132e64f9fb088462aab3358677b55b Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sat, 11 Mar 2023 12:35:38 -0500 Subject: [PATCH] add pre-commit configuration --- .pre-commit-hooks.yaml | 7 +++++++ README.rst | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .pre-commit-hooks.yaml 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 =======