mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-16 20:50:25 +00:00
feat: add support for pre-commit (#1396)
This commit is contained in:
parent
eff77d6342
commit
eb12064fab
2 changed files with 40 additions and 0 deletions
18
.pre-commit-hooks.yaml
Normal file
18
.pre-commit-hooks.yaml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
- id: lychee
|
||||
name: lychee
|
||||
description: "Run 'lychee' for fast, async, stream-based link checking"
|
||||
entry: lychee
|
||||
language: system
|
||||
args: ["--no-progress"]
|
||||
types: [text]
|
||||
pass_filenames: true
|
||||
require_serial: true
|
||||
- id: lychee-docker
|
||||
name: lychee
|
||||
description: "Run 'lychee' docker image for fast, async, stream-based link checking"
|
||||
entry: lycheeverse/lychee:0.14
|
||||
language: docker_image
|
||||
args: ["--no-progress"]
|
||||
types: [text]
|
||||
pass_filenames: true
|
||||
require_serial: true
|
||||
22
README.md
22
README.md
|
|
@ -25,6 +25,7 @@ Available as a command-line utility, a library and a [GitHub Action](https://git
|
|||
- [Commandline usage](#commandline-usage)
|
||||
- [Library usage](#library-usage)
|
||||
- [GitHub Action Usage](#github-action-usage)
|
||||
- [Pre-commit Usage](#pre-commit-usage)
|
||||
- [Contributing to lychee](#contributing-to-lychee)
|
||||
- [Debugging and improving async code](#debugging-and-improving-async-code)
|
||||
- [Troubleshooting and Workarounds](#troubleshooting-and-workarounds)
|
||||
|
|
@ -551,6 +552,27 @@ folder.
|
|||
A GitHub Action that uses lychee is available as a separate repository: [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action)
|
||||
which includes usage instructions.
|
||||
|
||||
## Pre-commit Usage
|
||||
|
||||
Lychee can also be used as a [pre-commit](https://pre-commit.com/) hook.
|
||||
```yaml
|
||||
# .pre-commit-config.yaml
|
||||
repos:
|
||||
- repo: https://github.com/lycheeverse/lychee.git
|
||||
rev: 0.14.3
|
||||
hooks:
|
||||
- id: lychee
|
||||
# Optionally include additional CLI arguments
|
||||
args: ["--no-progress", "--exclude", "file://"]
|
||||
```
|
||||
|
||||
Rather than running on staged-files only, Lychee can be run against an entire repository.
|
||||
```yaml
|
||||
- id: lychee
|
||||
args: ["--no-progress", "."]
|
||||
pass_filenames: false
|
||||
```
|
||||
|
||||
## Contributing to lychee
|
||||
|
||||
We'd be thankful for any contribution. \
|
||||
|
|
|
|||
Loading…
Reference in a new issue