diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 690a5de..eb37be1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,14 @@ pytest ruff check . ``` +Auto-format and auto-fix what ruff can fix on its own: + +```bash +scripts/format.sh +``` + +Use `scripts/format.sh --check` to verify formatting without writing changes. + ## Documentation User-facing documentation lives in [docs/](docs/) and is built with MkDocs. If you change or add public behaviour, update the relevant page there. diff --git a/scripts/format.sh b/scripts/format.sh new file mode 100755 index 0000000..64f7816 --- /dev/null +++ b/scripts/format.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Auto-format the codebase and fix auto-fixable lint issues with ruff. +# +# Usage: +# scripts/format.sh # format in place +# scripts/format.sh --check # fail if anything would change, don't write (for CI) +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +if [[ "${1:-}" == "--check" ]]; then + ruff format --check . + ruff check . +else + ruff format . + ruff check --fix . +fi diff --git a/src/earthrs/processing/atmospheric.py b/src/earthrs/processing/atmospheric.py index ea42ff6..533630b 100644 --- a/src/earthrs/processing/atmospheric.py +++ b/src/earthrs/processing/atmospheric.py @@ -18,4 +18,4 @@ def atmospheric_correction(scene: Scene, *, method: str = "default", **kwargs: A _ = kwargs raise NotImplementedError( "Atmospheric correction is not yet implemented. Check for a new version of earthrs." - ) \ No newline at end of file + )