Skip to content

Commit 567672e

Browse files
committed
feat: run-rust-backtick lint
Use srgn[1] to find comments that contain empty backtick pairs which vscode is happy to add. [1]: https://github.com/alexpovel/srgn
1 parent a475d30 commit 567672e

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,12 @@
155155
pass_filenames: false
156156
minimum_pre_commit_version: 0.15.0
157157
description: "Runs buf breaking at the repo root"
158+
159+
- id: rust-doc-backticks
160+
name: "rustdoc backticks"
161+
entry: run-rust-backticks.sh
162+
language: "script"
163+
files: \.rs$
164+
pass_filenames: true
165+
minimum_pre_commit_version: 0.15.0
166+
description: "Check for empty backtick pairs"

run-rust-backticks.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
# Find comments with empty backtick pairs (`thing``).
4+
#
5+
# Expects filenames to validate as script arguments.
6+
7+
set -euo pipefail
8+
9+
srgn -j --fail-no-files -G "$@" \
10+
--rust doc-comments \
11+
--rust comments \
12+
'[^`]`{2}[^`]+'

0 commit comments

Comments
 (0)