Add init-project task

- add a nox session "init-project"
  + it installs the pre-commit hooks
  + being a task, the session is run in the develop environment
This commit is contained in:
Alexander Hess 2020-10-02 16:31:36 +02:00
parent b2b29d9ec0
commit b0a5b49664
Signed by: alexander
GPG key ID: 344EA5AB10D868E0

View file

@ -2,6 +2,8 @@
Nox provides the following tasks:
- "init-project": install the pre-commit hooks
- "fix-branch-references": adjusts links with git branch references in
various files (e.g., Mardown or notebooks)
@ -28,6 +30,16 @@ nox.options.envdir = ".cache/nox"
nox.options.error_on_external_run = True
@nox.session(name="init-project", venv_backend="none")
def init_project(session):
"""Install the pre-commit hooks."""
for type_ in (
"pre-commit",
"pre-merge-commit",
):
session.run("poetry", "run", "pre-commit", "install", f"--hook-type={type_}")
@nox.session(name="fix-branch-references", venv_backend="none")
def fix_branch_references(_session):
"""Change git branch references.