From 87d28259a7f0f794f8475a5e2a9c9bfffb7ee20e Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Thu, 23 Sep 2021 12:02:00 -0400 Subject: [PATCH] Setup pre-commit styling --- .pre-commit-config.yaml | 49 +++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 13 +++++++++++ setup.cfg | 8 +++++++ 3 files changed, 70 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..f50aa8d7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,49 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-docstring-first + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/PyCQA/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + additional_dependencies: [flake8-typing-imports==1.7.0] + - repo: https://github.com/myint/autoflake + rev: v1.4 + hooks: + - id: autoflake + args: ["--in-place", "--remove-all-unused-imports", "--ignore-init-module-imports", "--remove-unused-variables"] + - repo: https://github.com/PyCQA/isort + rev: 5.8.0 + hooks: + - id: isort + - repo: https://github.com/psf/black + rev: 21.5b2 + hooks: + - id: black + - repo: https://github.com/asottile/pyupgrade + rev: v2.19.0 + hooks: + - id: pyupgrade + args: [--py37-plus] + - repo: https://github.com/pre-commit/mirrors-prettier + rev: 'v2.4.1' + hooks: + - id: prettier + types: [ts] + + - repo: https://github.com/pre-commit/mirrors-eslint + rev: 'v7.32.0' + hooks: + - id: eslint + files: \.ts$ # *.ts + types: [file] + additional_dependencies: + - eslint + - typescript + - '@typescript-eslint/eslint-plugin' + - '@typescript-eslint/parser' + - 'eslint-config-prettier' + - 'eslint-plugin-prettier' \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 498efe4a..9d66606a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,16 @@ norecursedirs = [ ".ipynb_checkpoints", ] addopts = "--nbval --current-env" + +[tool.isort] +profile = "black" +src_paths = "ipympl" +multi_line_output = 3 + +[tool.pydocstyle] +match_dir = "ipympl" +convention = "numpy" +add_select = ["D402","D415","D417"] + +[tool.black] +skip-string-normalization = true \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 5c6311da..0fc10f93 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,3 +3,11 @@ universal=1 [metadata] license_file = LICENSE + +[flake8] +exclude = docs, _version.py, .eggs, example +max-line-length = 88 +docstring-convention = "numpy" +extend-ignore = + # See https://github.com/PyCQA/pycodestyle/issues/373 + E203,