From 8b14d4f4e0f962fa987c7662471d9ee4757a1509 Mon Sep 17 00:00:00 2001 From: cohesity Date: Wed, 27 Jan 2021 19:23:26 +0530 Subject: [PATCH] Initial commit for Pre-commit After installing pre-commit for first time, run pre-commit => install command to install all the git hooks. pre-commit run --all-files => all the files are updated. Black formatter: 1. Will replace single quotes with double quotes. 2. Max line length 88. --- .pre-commit-config.yaml | 9 +++++++++ pyproject.toml | 2 ++ requirements.txt | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..1c417ba7c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +--- +repos: +- repo: https://github.com/psf/black + # Limits line length to 88, replace single quotes by double quotes, wrap function arguments. + rev: master + hooks: + - id: black + language_version: python + args: [ --config=./pyproject.toml] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..8bb6ee5f5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +line-length = 88 diff --git a/requirements.txt b/requirements.txt index 62ad312f6..3f6637453 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ requests==2.20.0 jsonpickle==0.7.1 cachecontrol==0.11.7 -python-dateutil==2.5.3 \ No newline at end of file +python-dateutil==2.5.3 +pre-commit==2.9.3