Skip to content

Commit

Permalink
Add env var to skip pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Nov 18, 2024
1 parent 87b6338 commit 42922e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning][].
### Fixes
- Remove vendored `hiyapyco` code since required changes were released upstream in v0.7.0 ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)).
- `None` values in `params.in.yaml` can now be used to override anything, e.g. to disable watermarking only in a specific stage ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)).
- DSO now respects a `DSO_SKIP_CHECK_ASK_PRE_COMMIT` environment variable. If it is set
to anything that evaluates as `True`, we skip the check if pre-commit is installed. This was a
requirement introduced by the R API package, see [#50](https://github.com/Boehringer-Ingelheim/dso/issues/50) ([#58](https://github.com/Boehringer-Ingelheim/dso/pull/58)).

## v0.9.0

Expand Down
7 changes: 7 additions & 0 deletions src/dso/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from functools import cache
from importlib import resources
from importlib.abc import Traversable
from os import environ
from pathlib import Path
from typing import Literal

Expand Down Expand Up @@ -205,7 +206,13 @@ def check_ask_pre_commit(dir: Path):
Check if pre-commit hooks are installed and asks to install them
If the user declines, info will be written to `.dso.json` to not ask again in the future.
Additionally, we respect a `DSO_SKIP_CHECK_ASK_PRE_COMMIT` environment variable. If it is set
to anything that evaluates as `True`, we skip the check and question altogether. This was a
requirement introduced by the R API package: https://github.com/Boehringer-Ingelheim/dso/issues/50.
"""
if environ.get("DSO_SKIP_CHECK_ASK_PRE_COMMIT", None):
return
config = _read_dot_dso_json(dir)
if config.get("check_ask_pre_commit", True):
project_root = get_project_root(dir)
Expand Down

0 comments on commit 42922e4

Please sign in to comment.