From bb5e42ff39fa7754a8fa7d72334396874c69ac9a Mon Sep 17 00:00:00 2001 From: Pascal Epple Date: Fri, 13 Oct 2023 14:04:34 +0200 Subject: [PATCH] Modified readme, visiumlinted the code --- README.md | 28 +++++++++++++++++++++++++++- src/visiumlint/main.py | 5 ++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 804fc0d..72eb33a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,33 @@ Visiumlint relies on `black`, `isort`, `pylint`, `pydocstyle` and `mypy`. - Activate the environment using `pipenv shell` - Run the visium package by running the command `visiumlint` - +# Hook + +You can automate visiumlint when commiting changes with a [git hook](https://githooks.com/) and the [pre-commit](https://pre-commit.com/) library. + +- Make sure to have installed pre-commit, or else run `brew install pre-commit` + +- Add a file called `.pre-commit-config.yaml` to the root of your project: +```yaml +repos: +- repo: https://github.com/VisiumCH/visiumlint + rev: 1.6.0 + hooks: + - id: visiumlint + language: python + types: [python] + require_serial: true + +- repo: local + hooks: + - id: pylint + name: pylint + entry: pylint + language: python + types: [python] + require_serial: true +``` +- Run `pre-commit autoupdate`. This will use the latest available version of visiumlint. # Development ## Manage your python environment diff --git a/src/visiumlint/main.py b/src/visiumlint/main.py index 15e3138..ba82f1d 100644 --- a/src/visiumlint/main.py +++ b/src/visiumlint/main.py @@ -6,7 +6,10 @@ import typer -def lint(check_lint: bool = typer.Option(False, "--check", help="Enable check mode."), hook : bool = typer.Option(False, "--hook", help="Enable hook mode.")) -> None: +def lint( + check_lint: bool = typer.Option(False, "--check", help="Enable check mode."), + hook: bool = typer.Option(False, "--hook", help="Enable hook mode."), +) -> None: """Implement the logic of the lint command.""" if check_lint: check_lint = "--check"