From 1d73f28e15b78ecf5225e68d750b768ca5199cb7 Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Sat, 16 Jul 2022 17:59:02 -0600 Subject: [PATCH] update pre-commit and add prettier --- .pre-commit-config.yaml | 58 +++++++++++++++++++++++++++-------------- .prettierrc.toml | 3 +++ pyproject.toml | 2 ++ setup.cfg | 2 ++ 4 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 .prettierrc.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1bfb9ed86c..3af7f91377 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,28 +1,48 @@ +ci: + autoupdate_schedule: monthly + repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-docstring-first + - id: check-json + - id: check-yaml + - id: double-quote-string-fixer + - id: debug-statements + - id: mixed-line-ending + + - repo: https://github.com/asottile/pyupgrade + rev: v2.37.1 + hooks: + - id: pyupgrade + args: + - '--py38-plus' + + - repo: https://github.com/psf/black + rev: 22.6.0 + hooks: + - id: black + - id: black-jupyter -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.1.0 + - repo: https://github.com/keewis/blackdoc + rev: v0.3.4 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-docstring-first - - id: check-json - - id: check-yaml - - id: pretty-format-json - args: ["--autofix", "--indent=2", "--no-sort-keys"] + - id: blackdoc -- repo: https://github.com/ambv/black - rev: 19.10b0 + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 hooks: - - id: black - args: ["--line-length", "100"] + - id: flake8 -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 + - repo: https://github.com/PyCQA/isort + rev: 5.10.1 hooks: - - id: flake8 + - id: isort -- repo: https://github.com/pre-commit/mirrors-isort - rev: v5.2.0 + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.7.1 hooks: - - id: isort + - id: prettier diff --git a/.prettierrc.toml b/.prettierrc.toml new file mode 100644 index 0000000000..addd6d363c --- /dev/null +++ b/.prettierrc.toml @@ -0,0 +1,3 @@ +tabWidth = 2 +semi = false +singleQuote = true diff --git a/pyproject.toml b/pyproject.toml index aa4949aa1c..477f5c6550 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,4 @@ [tool.black] line-length = 100 +target-version = ['py38'] +skip-string-normalization = true diff --git a/setup.cfg b/setup.cfg index 63c8163c16..b335117d73 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,7 @@ [flake8] max-line-length = 100 +max-complexity = 18 +select = B,C,E,F,W,T4,B9 [isort] known_first_party=pangeo_forge_recipes