Skip to content
Open
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
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: local
hooks:
- id: flake8-critical
name: flake8 critical errors
entry: poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
language: system
pass_filenames: false

- id: mypy
name: mypy
entry: poetry run mypy cmr tests
language: system
pass_filenames: false

- id: pytest
name: pytest
entry: poetry run pytest
language: system
pass_filenames: false
stages: [pre-push]
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contributing

## Development setup

Install the project dependencies with Poetry:

```bash
poetry install
```

## Pre-commit checks

The repository includes pre-commit hooks that mirror the important local CI checks:

- critical `flake8` errors run before commits;
- `mypy` runs before commits;
- the full `pytest` suite runs before pushes.

Install pre-commit, then enable both hook stages:

```bash
python -m pip install pre-commit
pre-commit install --hook-type pre-commit --hook-type pre-push
```

Run all commit-stage hooks manually with:

```bash
pre-commit run --all-files
```

Run the pre-push test hook manually with:

```bash
pre-commit run --all-files --hook-stage pre-push
```

The hook commands use the project's Poetry environment, so run `poetry install` first.