From a3f6089e72d03b1da7372d10963a90b528bfe200 Mon Sep 17 00:00:00 2001 From: cosimoNigro Date: Fri, 1 Sep 2023 12:33:56 +0200 Subject: [PATCH] added pre-commit hooks with isort, black and flake8 --- .pre-commit-config.yaml | 18 ++++++++++++++++++ environment.yml | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) 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..76a69e51 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + # https://pycqa.github.io/isort/docs/configuration/black_compatibility.html#integration-with-pre-commit + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + args: ["--profile", "black", "--filter-files"] + - repo: https://github.com/psf/black + rev: 22.6.0 + hooks: + - id: black + # https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html?highlight=other%20tools#flake8 + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + exclude: experiments + args: ["--count", "--max-line-length=100", "--extend-ignore=E203,E712,W503"] diff --git a/environment.yml b/environment.yml index ae24b1de..7a54a170 100644 --- a/environment.yml +++ b/environment.yml @@ -13,7 +13,7 @@ dependencies: - pyyaml # needed to read astropy ecsv file - matplotlib - sherpa + - pre-commit - pip: - agnpy - gammapy -