Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit hooks and documentation #3

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"