Skip to content

Commit 35364f5

Browse files
committed
feat: added support for pre-commit
1 parent d5ddf66 commit 35364f5

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.pre-commit-hooks.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- id: lychee
2+
name: lychee
3+
description: "Run 'lychee' for fast, async, stream-based link checking"
4+
entry: lycheeverse/lychee:0.14
5+
language: docker_image
6+
args: []
7+
types: [text]
8+
pass_filenames: true
9+
require_serial: true
10+
additional_dependencies: []

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: ["--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: ["."]
573+
pass_filenames: false
574+
```
575+
554576
## Contributing to lychee
555577
556578
We'd be thankful for any contribution. \

0 commit comments

Comments
 (0)