Skip to content

Commit

Permalink
refactor: update pre-commit config and hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
LangLangBart committed Sep 22, 2024
1 parent 691c8fd commit 8679da1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 38 deletions.
51 changes: 18 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
5 changes: 0 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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`.

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8679da1

Please sign in to comment.