From 8679da18fc19f9737e72572e46e2600ef4608ac9 Mon Sep 17 00:00:00 2001 From: LangLangbart <92653266+LangLangBart@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:12:15 +0200 Subject: [PATCH] refactor: update pre-commit config and hooks --- .pre-commit-config.yaml | 51 +++++++++++++++-------------------------- readme.md | 5 ---- 2 files changed, 18 insertions(+), 38 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d6aed8e..607d287 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,58 +11,43 @@ repos: hooks: - id: typos args: [--format, brief, --write-changes, --force-exclude] - - repo: local + - repo: https://github.com/tcort/markdown-link-check + rev: v3.12.2 hooks: - - id: binaries - name: binary check for shellcheck/shfmt - entry: | - sh -c ' - for tool in shellcheck shfmt; do - if ! command -v $tool >/dev/null 2>&1; then - echo "$tool could not be found, please install it" - exit 1 - fi - done' - language: system - pass_filenames: false - fail_fast: true - - repo: https://github.com/jumanjihouse/pre-commit-hooks - rev: 3.0.0 + - id: markdown-link-check + name: markdown link check + args: [--quiet] + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 hooks: - # requires a local version of 'shellcheck' - id: shellcheck - name: shellcheck args: [--external-source, --norc] - # requires a local version of 'shfmt' + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.9.0-1 + hooks: - id: shfmt - name: shfmt - args: [--simplify, --indent 0, --case-indent, --write] + args: [--simplify, --indent, '0', --case-indent, --write] - repo: https://github.com/lyz-code/yamlfix rev: 1.17.0 hooks: - id: yamlfix - - repo: https://github.com/tcort/markdown-link-check - rev: v3.12.2 - hooks: - - id: markdown-link-check - name: markdown link check - args: [--quiet] - - repo: local + - repo: https://github.com/crate-ci/typos + rev: v1.24.6 hooks: - - id: commit-msg-typos - name: check commit message for typos - # requires a local version of 'typos' otherwise skip it - entry: sh -c 'command -v typos >/dev/null 2>&1 && typos "$0" || true' - language: system + - id: typos + name: detect typos in commit message + args: [--format, brief] stages: [commit-msg] - repo: https://github.com/jorisroovers/gitlint rev: v0.19.1 hooks: - id: gitlint + name: validate commit message format args: [--ignore, body-is-missing, --msg-filename] stages: [commit-msg] - repo: https://github.com/commitizen-tools/commitizen rev: v3.29.0 hooks: - id: commitizen + name: check commit message structure stages: [commit-msg] diff --git a/readme.md b/readme.md index 84130d4..efa3bdd 100644 --- a/readme.md +++ b/readme.md @@ -35,7 +35,6 @@ gh find-code [Flags] [Search query] | `filename` | `'filename:.zshrc GOCACHE'` | search in all filenames `.zshrc` for `GOCACHE` | | `extension` | `'extension:rs "Hello, world!"'` | find `.rs` files with the string `Hello, world!` | - > [!IMPORTANT] > The search syntax differs between the WebUI and the REST API, with the latter > not supporting regex. @@ -102,7 +101,6 @@ gh ext remove LangLangBart/gh-find-code | `GHFC_HISTORY_FILE` | Custom location | `${XDG_STATE_HOME:-$HOME/.local/state}/gh-find-code/history.txt` | | `GHFC_HISTORY_LIMIT` | Max number of stored commands | `500` | - To avoid interfering with a user's typical keybinds, you can overwrite the following keybinds to another key. For example, change `ctrl-p` to `ctrl-u`. @@ -203,9 +201,6 @@ GHFC_HISTORY_LIMIT="1000" gh find-code > **Source:** [pre-commit introduction](https://pre-commit.com/#introduction) ```sh -# shellcheck and shfmt are necessary dependencies for one hook -brew install pre-commit shellcheck shfmt - # install the git hook scripts pre-commit install --hook-type commit-msg --hook-type pre-commit # pre-commit installed at .git/hooks/commit-msg