Skip to content

Commit

Permalink
Add a check for broken use of :user: in RST
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Apr 1, 2021
1 parent 1c8fa48 commit 56d504c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ repos:
exclude: >-
^docs/changelog/(\d+\.(bugfix|feature|deprecation|breaking|doc|misc).rst|README.rst|template.jinja2)
files: ^docs/changelog/
- id: changelogs-user-role
name: changelog files have a non-broken :user:`name` role
language: system
entry: >-
sh -c '
rc=0;
for f in "$@";
do
if ! >/dev/null grep ":user:" -- "${f}";
then
continue;
fi;
grep ":user:" -- "${f}"
| sed "s/.*\(:user:[^ .,]\+\).*$/\1/"
| >/dev/null grep -v "^:user:\`[^ \`]\+\`";
if [ "$?" -eq 0 ];
then
rc=1;
2>&1 echo ":user: RST role syntax is broken in '${f}'...";
fi;
done;
exit $rc
'
pass_filenames: true
types: [file, rst]

0 comments on commit 56d504c

Please sign in to comment.