Skip to content

Commit

Permalink
adding more pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ludwiglierhammer committed Dec 1, 2023
1 parent 676a0fb commit 99a4550
Show file tree
Hide file tree
Showing 16 changed files with 1,073 additions and 858 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: index_calculator Testing Suite

on:
push:
branches:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testpypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
run: |
python -m twine check --strict dist/*
if [ -f dist/index_calculator-0.0.0.tar.gz ]; then
echo "INVALID VERSION NUMBER"
echo "INVALID VERSION NUMBER"
exit 1
else
echo "Looks good"
echo "Looks good"
fi
- uses: actions/upload-artifact@v3
Expand Down
113 changes: 71 additions & 42 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
ci:
autoupdate_schedule: quarterly
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: quarterly
submodules: false

default_language_version:
python: python3.11

repos:

Expand All @@ -9,64 +20,77 @@ repos:
- id: pyupgrade
args: ["--py39-plus"]

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.1'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: ruff
args: ["--show-fixes", "--fix"]
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-yaml
args: ['--allow-multiple-documents']
- id: debug-statements
- id: pretty-format-json
args: ['--autofix', '--no-ensure-ascii', '--no-sort-keys']
exclude: '.ipynb'

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.1
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: black
- id: toml-sort-fix

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: rstcheck
additional_dependencies: [sphinx, tomli]
args: ['--config', 'pyproject.toml']
- id: yamllint
args: ['--config-file=.yamllint.yaml']

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.17
- repo: https://github.com/psf/black
rev: 23.10.1
hooks:
- id: mdformat
additional_dependencies:
- mdformat-black
- mdformat-myst
- id: black

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.4
hooks:
- id: nbqa-black
- id: nbqa-ruff
args: ["--fix"]
- id: nbqa
entry: nbqa mdformat
name: nbqa-mdformat
alias: nbqa-mdformat
additional_dependencies: [mdformat==0.7.17]
- id: ruff
args: ["--show-fixes", "--fix"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: nbqa-black
- id: nbqa-ruff
args: ["--fix"]
- id: nbqa-pyupgrade
args: ['--py38-plus']
- id: nbqa-isort
args: ['--settings-file=pyproject.toml']

- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
rev: v0.3.9
hooks:
- id: blackdoc
files: .+\.py$
additional_dependencies: ['black==23.10.1']

- repo: https://github.com/citation-file-format/cff-converter-python
rev: "44e8fc9"
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.1
hooks:
- id: black

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.1
hooks:
- id: validate-cff
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
hooks:
- id: rstcheck
additional_dependencies: [sphinx, tomli]
args: ['--config', 'pyproject.toml']

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
Expand All @@ -79,3 +103,8 @@ repos:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
2 changes: 1 addition & 1 deletion .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
rules:
document-start: disable
line-length:
max: 120
max: 130
level: warning
truthy: disable
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,22 @@ This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypack
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Python Black

.. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ludwiglierhammer/index_calculator/master.svg
:target: https://results.pre-commit.ci/latest/github/ludwiglierhammer/index_calculator/master
:alt: pre-commit.ci status

.. |fossa| image:: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fludwiglierhammer%2Findex_calculator.svg?type=shield
:target: https://app.fossa.com/projects/git%2Bgithub.com%2Fludwiglierhammer%2Findex_calculator?ref=badge_shield
:alt: FOSSA

.. |security| image:: https://www.bestpractices.dev/projects/8143/badge
:target: https://www.bestpractices.dev/projects/8143
:alt: Open Source Security Foundation
:alt: Open Source Security Foundation

.. |status| image:: https://www.repostatus.org/badges/latest/active.svg
:target: https://www.repostatus.org/#active
Expand Down
Empty file modified index_calculator/__init__.py
100644 → 100755
Empty file.
Empty file modified index_calculator/_postprocessing.py
100644 → 100755
Empty file.
Empty file modified index_calculator/_processing.py
100644 → 100755
Empty file.
34 changes: 17 additions & 17 deletions index_calculator/tables/cf_conversion.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"EOBS": {
"variables": {
"tn": "tasmin",
"hu": "hurs",
"rr": "pr",
"fg": "sfcWind",
"pp": "ps",
"tx": "tasmax",
"tg": "tas",
"qq": "rsds"
},
"units": {
"pr": "mm day-1"
}
}
}
{
"EOBS": {
"variables": {
"tn": "tasmin",
"hu": "hurs",
"rr": "pr",
"fg": "sfcWind",
"pp": "ps",
"tx": "tasmax",
"tg": "tas",
"qq": "rsds"
},
"units": {
"pr": "mm day-1"
}
}
}
44 changes: 22 additions & 22 deletions index_calculator/tables/convert_to_frequency.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"day": {
"var": {
"hurs": "mean",
"pr": "mean",
"prsn": "mean",
"rlds": "mean",
"rlus": "mean",
"rsds": "mean",
"rsus": "mean",
"sfcWind": "mean",
"sfcWindmax": "max",
"snd": "mean",
"tas": "mean",
"tasmax": "max",
"tasmin": "min",
"uas": "mean",
"vas": "mean"
},
"freq": "D"
}
}
{
"day": {
"var": {
"hurs": "mean",
"pr": "mean",
"prsn": "mean",
"rlds": "mean",
"rlus": "mean",
"rsds": "mean",
"rsus": "mean",
"sfcWind": "mean",
"sfcWindmax": "max",
"snd": "mean",
"tas": "mean",
"tasmax": "max",
"tasmin": "min",
"uas": "mean",
"vas": "mean"
},
"freq": "D"
}
}
Loading

0 comments on commit 99a4550

Please sign in to comment.