Skip to content

Commit eb12064

Browse files
authored
feat: add support for pre-commit (#1396)
1 parent eff77d6 commit eb12064

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.pre-commit-hooks.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- id: lychee
2+
name: lychee
3+
description: "Run 'lychee' for fast, async, stream-based link checking"
4+
entry: lychee
5+
language: system
6+
args: ["--no-progress"]
7+
types: [text]
8+
pass_filenames: true
9+
require_serial: true
10+
- id: lychee-docker
11+
name: lychee
12+
description: "Run 'lychee' docker image for fast, async, stream-based link checking"
13+
entry: lycheeverse/lychee:0.14
14+
language: docker_image
15+
args: ["--no-progress"]
16+
types: [text]
17+
pass_filenames: true
18+
require_serial: true

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Available as a command-line utility, a library and a [GitHub Action](https://git
2525
- [Commandline usage](#commandline-usage)
2626
- [Library usage](#library-usage)
2727
- [GitHub Action Usage](#github-action-usage)
28+
- [Pre-commit Usage](#pre-commit-usage)
2829
- [Contributing to lychee](#contributing-to-lychee)
2930
- [Debugging and improving async code](#debugging-and-improving-async-code)
3031
- [Troubleshooting and Workarounds](#troubleshooting-and-workarounds)
@@ -551,6 +552,27 @@ folder.
551552
A GitHub Action that uses lychee is available as a separate repository: [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action)
552553
which includes usage instructions.
553554

555+
## Pre-commit Usage
556+
557+
Lychee can also be used as a [pre-commit](https://pre-commit.com/) hook.
558+
```yaml
559+
# .pre-commit-config.yaml
560+
repos:
561+
- repo: https://github.com/lycheeverse/lychee.git
562+
rev: 0.14.3
563+
hooks:
564+
- id: lychee
565+
# Optionally include additional CLI arguments
566+
args: ["--no-progress", "--exclude", "file://"]
567+
```
568+
569+
Rather than running on staged-files only, Lychee can be run against an entire repository.
570+
```yaml
571+
- id: lychee
572+
args: ["--no-progress", "."]
573+
pass_filenames: false
574+
```
575+
554576
## Contributing to lychee
555577
556578
We'd be thankful for any contribution. \

0 commit comments

Comments
 (0)