Skip to content

Commit

Permalink
Merge pull request #3 from ESGF/feature/improved-precommit
Browse files Browse the repository at this point in the history
Update pre-commit hooks and documentation
  • Loading branch information
djspstfc authored Jul 23, 2024
2 parents 4bcf8c7 + c54bc5c commit 22566bc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ jobs:
- name: Run audit
run: |
pipx inject poetry poetry-audit-plugin
poetry audit
poetry audit $(poetry run python -c "import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); ignore_codes = data['tool']['quality']['audit']['ignore-code']; print('--ignore-code=' + ','.join(ignore_codes)) if ignore_codes else print('')")
- name: Run xenon
run: |
poetry install --only xenon
poetry run xenon . -a A -b A -m A
poetry run xenon -a $(poetry run python -c "import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); print(data['tool']['quality']['mccabe']['average'])") -b $(poetry run python -c "import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); print(data['tool']['quality']['mccabe']['block'])") -m $(poetry run python -c "import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); print(data['tool']['quality']['mccabe']['module'])") .
- name: Run mypy
run: |
poetry install --with mypy
Expand Down
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,18 @@ repos:
entry: poetry run ruff check --fix
language: system
types: [file, python]
- id: bandit
name: bandit
entry: poetry run bandit -c pyproject.toml -r .
language: system
types: [file, python]
- id: xenon
name: xenon
entry: bash -c "poetry run xenon -a $(poetry run python -c \"import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); print(data['tool']['quality']['mccabe']['average'])\") -b $(poetry run python -c \"import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); print(data['tool']['quality']['mccabe']['block'])\") -m $(poetry run python -c \"import tomllib; f = open('pyproject.toml','rb') ; data = tomllib.load(f); f.close(); print(data['tool']['quality']['mccabe']['module'])\") . "
language: system
types: [file, python]
- id: mypy
name: mypy
entry: poetry run mypy --no-namespace-packages --exclude esgf_playground_utils/models/__init__.py
language: system
types: [ file, python ]
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,5 @@

Common models, configuration and functionality for the ESGF-Playground.

## How to contribute?

This is simple library and is expected to undergo many changes as it matures towards the expected outcome of a suite
for the new ESGF publication system.

To contribute, you should be using `poetry` as your python package manager, see https://python-poetry.org for
installation instructions.

To install all package and development dependencies:

```shell
foo@bar:~$ poetry install
```

To activate the `pre-commit hooks` run:

```shell
foo@bar:~$ poetry run install pre-commit
```
16 changes: 15 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "esgf-playground-utils"
version = "0.3.0"
version = "0.3.1-alpha"
description = "Common library and models for the ESGF-Playground"
authors = ["David Poulter <[email protected]>"]
readme = "README.md"
Expand Down Expand Up @@ -60,9 +60,23 @@ target-version = "py39"
docstring-code-format = true
indent-style = "space"

[tool.coverage.run]
branch = true

[tool.coverage.report]
fail_under = 100

[tool.quality.mccabe]
average = "A"
block = "A"
module = "A"

[tool.bandit]
skips = []

[tool.quality.audit]
ignore-code = ["CVE-2019-8341"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 22566bc

Please sign in to comment.