Skip to content

Commit

Permalink
feat: add support for pre-commit (#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattTimms committed Apr 15, 2024
1 parent eff77d6 commit eb12064
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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. \
Expand Down

0 comments on commit eb12064

Please sign in to comment.