Add comment line length check to linting script

Change-Id: I8543abb74440c92df5fe5b8b29baff178adda123
This commit is contained in:
hikari_no_yume
2023-11-07 18:58:11 +01:00
parent e111706b42
commit 3379d6cd76

View File

@@ -1,4 +1,21 @@
#!/bin/sh
echo 'Checking for long comment lines…'
# Single-line comments are easy to find and they are the norm in this project,
# so only those are checked for.
# Comments not preceded by whitespace are ignored since the line length limit
# for source is longer than 80 currently.
# Comments containing URLs are ignored because wrapping those is unreasonable.
(grep -n '^ *\/\/' \
-r --include '*.rs' --include '*.cpp' --include '*.hpp' --include '*.c' \
--include '*.h' --include '*.m' \
build.rs src tests/*.rs tests/TestApp_source \
| grep '[^:]\+:[^:]\+:.\{81,\}' \
| grep -v 'https:\|http:') \
&& printf '\e[31m''Overly long comment lines found. Please wrap comment lines to 80 characters.''\e[0m\n' && exit 1
printf '\e[32mNone found.\e[0m\n'
set -ex
cargo clippy
cargo doc