-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pre-commit and QA configs (#262)
This commit updates the pre-commit hooks to use newer versions of the plugins and also fixes the configuration to be able to run in the current monorepo layout, where git hooks are still executed from the root of the repository. Main changes: - Update pre-commit hook versions and settings, adding paths relative to repo root - Add pre-commit and flake8 settings per model component folder - Add GitHub CI action versions - Add python caches to Github CI actions - Update formatting in yaml and toml files - Apply correct formatting to existing python files
- Loading branch information
Showing
99 changed files
with
650 additions
and
862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# NOTE: pre-commit runs all hooks from the root folder of the repository, | ||
# as regular git hooks do. Therefore, paths passed as arguments to the plugins | ||
# should always be relative to the root folder. | ||
|
||
default_stages: [commit, push] | ||
default_language_version: | ||
python: python3.10 | ||
minimum_pre_commit_version: 2.20.0 | ||
files: "model/atmosphere/dycore/.*" | ||
|
||
repos: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
stages: [manual] | ||
- id: check-useless-excludes | ||
stages: [manual] | ||
|
||
- repo: https://github.com/asottile/setup-cfg-fmt | ||
rev: v1.20.1 | ||
hooks: | ||
# Run only manually because it deletes comments | ||
- id: setup-cfg-fmt | ||
name: format setup.cfg | ||
stages: [manual] | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-symlinks | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: destroyed-symlinks | ||
|
||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks | ||
rev: v2.6.0 | ||
hooks: | ||
- id: pretty-format-ini | ||
args: [--autofix] | ||
- id: pretty-format-toml | ||
args: [--autofix] | ||
- id: pretty-format-yaml | ||
args: [--autofix, --preserve-quotes, --indent, "2"] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.0-alpha.4 | ||
hooks: | ||
- id: prettier | ||
types_or: [markdown, json] | ||
|
||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.3.0 | ||
hooks: | ||
- id: insert-license | ||
name: add license for all ICON4Py Python source files | ||
types: [python] | ||
args: [--comment-style, "|#|", --license-filepath, model/.license_header.txt, --fuzzy-match-generates-todo] | ||
|
||
- repo: https://github.com/asottile/yesqa | ||
rev: v1.3.0 | ||
hooks: | ||
- id: yesqa | ||
|
||
- repo: https://github.com/psf/black | ||
rev: '22.3.0' | ||
hooks: | ||
- id: black | ||
name: black Python formatter | ||
args: [--config, model/atmosphere/dycore/pyproject.toml] | ||
|
||
- repo: https://github.com/asottile/blacken-docs | ||
rev: v1.12.1 | ||
hooks: | ||
- id: blacken-docs | ||
name: black Python formatter for docstrings | ||
additional_dependencies: [black==22.3.0] | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: '5.12.0' | ||
hooks: | ||
- id: isort | ||
args: [--config-root, model/atmosphere/dycore/, --resolve-all-configs] | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: '4.0.1' | ||
hooks: | ||
- id: flake8 | ||
name: flake8 code style checks | ||
additional_dependencies: | ||
- darglint | ||
- flake8-bugbear | ||
- flake8-builtins | ||
- flake8-debugger | ||
- flake8-docstrings | ||
- flake8-eradicate | ||
- flake8-mutable | ||
- pygments | ||
args: [--config=model/atmosphere/dycore/.flake8, model/atmosphere/dycore/src/icon4py/] | ||
|
||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: mypy static type checker | ||
entry: bash -c 'echo mypy temporarily disabled' | ||
#entry: bash -c 'cd model/atmosphere/dycore; mypy src/' -- | ||
language: system | ||
types_or: [python, pyi] | ||
always_run: true | ||
#pass_filenames: false | ||
require_serial: true | ||
stages: [commit] |
Oops, something went wrong.