Skip to content
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
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
SKIP: update-copyright
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
4 changes: 2 additions & 2 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: uv sync --locked --all-extras --dev
- name: Unit tests with pytest
run: |
uv run pytest src
uv run pytest src --cov-fail-under=0
integration_tests:
runs-on: ubuntu-latest
needs: unit_tests
Expand Down Expand Up @@ -75,4 +75,4 @@ jobs:
run: uv sync --locked --all-extras --dev
- name: Unit tests with pytest
run: |-
uv run pytest tests/*/test_system_*.py
uv run pytest tests/*/test_system_*.py --cov-fail-under=0
20 changes: 0 additions & 20 deletions .github/workflows/style.yml

This file was deleted.

128 changes: 96 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,65 @@ exclude: |
)

repos:
# GENERAL PURPOSE ##################################################################
# PROCEDURAL ########################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Forbid comitting large files
- id: check-added-large-files
args: [--maxkb=500]
# Forbid names that would conflict in non-case-sensitive filesystems
- id: check-case-conflict
- id: check-executables-have-shebangs
# Forbid merge conflict markers
- id: check-merge-conflict
args: [--assume-in-merge]
- id: check-shebang-scripts-are-executable
# Check that symlinks are up to date
- id: check-symlinks
- id: check-vcs-permalinks
# Check for destroyed symlinks
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
# Forbid allow submodules
- id: forbid-submodules
- id: mixed-line-ending
- id: name-tests-test
args: [--pytest-test-first]
# Don't allow committing to protected branches.
- id: no-commit-to-branch
args: [-b, main, -b, master, -b, dev, -b, develop]
stages: [pre-commit]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/pre-commit/sync-pre-commit-deps
rev: v0.0.3
hooks:
# Sync additional dependencies between hooks
- id: sync-pre-commit-deps

- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.8
hooks:
# Require conventional commit messages
- id: commitizen

# GENERAL PURPOSE ###################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# Forbid executable files without shebangs
- id: check-executables-have-shebangs
# Forbid shebangs in non-executable files
- id: check-shebang-scripts-are-executable
# Require that vcs links are permalinks
- id: check-vcs-permalinks
# Insert blank newlines at the ends of files
- id: end-of-file-fixer
#
- id: fix-byte-order-marker
# Forbid mixed line endings
- id: mixed-line-ending
# Enforce test naming convention
- id: name-tests-test
args: [--pytest-test-first]
exclude: tests/examples/.*
# Remove trailing whitespaces at the ends of lines
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: 'v1.10.0'
hooks:
Expand All @@ -52,39 +79,53 @@ repos:
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
# Remove outdated noqa markers
- id: yesqa

- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v3.2.0
hooks:
- id: setup-cfg-fmt

- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.8
hooks:
- id: commitizen

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
# Spellchecking
- id: codespell
args: [-w]

- repo: https://github.com/BenjaminMummery/pre-commit-hooks
rev: v2.8.0
hooks:
# Add a copyright notice to files that don't have one
- id: add-copyright
exclude: CHANGELOG.md
# Append jira issue from the branch name to the commit
- id: add-msg-issue
# Update existing copyright markers.
- id: update-copyright
# Sort the .gitignore file (respects sections)
- id: sort-file-contents
files: .gitignore

# SECURITY ##########################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: detect-private-key

- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
hooks:
- id: gitleaks

- repo: https://github.com/thoughtworks/talisman
rev: 'v1.37.0'
hooks:
- id: talisman-push
- id: talisman-commit

# CONFIGURATION #####################################################################
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v3.2.0
hooks:
- id: setup-cfg-fmt

# C++ ###############################################################################
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v21.1.8'
Expand All @@ -99,10 +140,10 @@ repos:
- id: cmake-lint

# MARKDOWN #########################################################################
- repo: https://github.com/frnmst/md-toc
rev: 9.0.0
- repo: https://github.com/thlorenz/doctoc
rev: 'v2.3.0'
hooks:
- id: md-toc
- id: doctoc

# PYTHON ###########################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -111,6 +152,7 @@ repos:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
exclude: tests/examples/.*
- id: debug-statements
- id: requirements-txt-fixer

Expand All @@ -125,6 +167,11 @@ repos:
- id: python-no-log-warn
- id: python-use-type-annotations

- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma

- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
Expand Down Expand Up @@ -161,15 +208,15 @@ repos:
hooks:
- id: interrogate
args: [--config=pyproject.toml]
exclude: test_.*\.py|conftest.py
exclude: tests/.*|test_.*\.py|conftest.py

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: ['--ignore=D105,D107,D202,D203,D204,D212,D406,D407,D413']
additional_dependencies: [tomli]
exclude: test_.*\.py|conftest.py
exclude: tests/.*|test_.*\.py|conftest.py

# YAML #############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -230,6 +277,23 @@ repos:
--indent 4,
]

# JUPYTER NOTEBOOKS #################################################################
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa-black
- id: nbqa-pyupgrade
args: ["--py37-plus"]
- id: nbqa-isort
args: ["--float-to-top"]

# TERRAFORM #########################################################################
- repo: https://github.com/AleksaC/terraform-py
rev: v1.14.5
hooks:
- id: tf-fmt
- id: tf-validate

# TOML ##############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY : test_unit test_system test_integration
.PHONY: all clean test

define PRETTYPRINT_PYSCRIPT
import sys, os
Expand Down Expand Up @@ -31,12 +31,16 @@ test_all: test_unit test_integration test_system
# TESTING BY LEVEL
test_unit:
@uv run python -c "$$PRETTYPRINT_PYSCRIPT" RUNNING UNIT TESTS; \
uv run pytest --cov=src src/ -x
uv run pytest src/ -x --cov-fail-under=0

test_integration:
@uv run python -c "$$PRETTYPRINT_PYSCRIPT" RUNNING INTEGRATION TESTS; \
uv run pytest --cov=src tests/*/test_integration_*.py -x
uv run pytest tests/*/test_integration_*.py -x

test_system:
@uv run python -c "$$PRETTYPRINT_PYSCRIPT" RUNNING SYSTEM TESTS; \
uv run pytest tests/*/test_system_*.py -x
uv run pytest tests/*/test_system_*.py -x --cov-fail-under=0

# RUNNING PRE-COMMIT HOOKS
lint:
@SKIP=update-copyright uv run pre-commit run --all-files
Loading