From 0e9efa10ddbebe0c16da73c6e3850d6cc690e182 Mon Sep 17 00:00:00 2001 From: mehrad Date: Sun, 23 May 2021 00:20:49 -0700 Subject: [PATCH] Add config for flake, black, and isort and pre-commit config --- .flake8 | 5 +++++ .isort.cfg | 7 +++++++ .pre-commit-config.yaml | 21 +++++++++++++++++++++ pyproject.toml | 15 +++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 .flake8 create mode 100644 .isort.cfg create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..c2702550 --- /dev/null +++ b/.flake8 @@ -0,0 +1,5 @@ +[flake8] +max-line-length = 127 +max-complexity = 18 +select = B, C, E, F, W, T4, B9 +ignore = E203, E266, E501, W503, F403, F401, W605, E722, C901 diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..85ea2f58 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,7 @@ +[settings] +line_length=127 +multi_line_output=3 +include_trailing_comma=True +;force_grid_wrap=0 +known_first_party = tests +known_third_party = bootleg,datasets,dill,elasticsearch,kfserving,marisa_trie,nltk,numpy,pathos,pyrouge,requests,sacrebleu,sentence_transformers,seqeval,setuptools,sklearn,tensorboardX,torch,tqdm,transformers,ujson,xgboost diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..45fb33b9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/PyCQA/isort + rev: 5.8.0 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 21.5b1 + hooks: + - id: black + language_version: python3.8 +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: flake8 + verbose: true diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..486264ee --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.black] +line-length = 127 +target-version = ['py38'] +skip-string-normalization = true +exclude = ''' +/( + \.git + | \.mypy_cache + | \.venv + | _build + | buck-out + | build + | dist +)/ +''' \ No newline at end of file