mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 17:57:56 +00:00
3c50838dc3
* change (CI): markdown link checker * Fix some invalid doc links (re-run of cargo-unleash gen-readme w/ fixes). * Fix some invalid doc links * Fix some invalid doc links * Fix some links * Fix some links * Apply @bkchr suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Fix more links * Fix more links * typo * Fix more links * Fix more links * Ignore valid link .. check wrongly sees it as invalid * Fix style issue * Fix style issue * change (CI): update style guide link * change (lib): suggestions Co-authored-by: Dan Forbes <dan@danforbes.dev> Co-authored-by: Steve Degosserie <steve@parity.io> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
56 lines
1.5 KiB
Bash
Executable File
56 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# check if line width of rust source files is not beyond x characters
|
|
#
|
|
set -e
|
|
set -o pipefail
|
|
|
|
BASE_ORIGIN="origin"
|
|
BASE_BRANCH_NAME="master"
|
|
LINE_WIDTH="120"
|
|
GOOD_LINE_WIDTH="100"
|
|
BASE_BRANCH="${BASE_ORIGIN}/${BASE_BRANCH_NAME}"
|
|
git fetch ${BASE_ORIGIN} ${BASE_BRANCH_NAME} --depth 100
|
|
BASE_HASH=$(git merge-base ${BASE_BRANCH} HEAD)
|
|
|
|
git diff --name-only ${BASE_HASH} -- \*.rs | ( while read file
|
|
do
|
|
if [ ! -f ${file} ];
|
|
then
|
|
echo "Skipping removed file."
|
|
elif git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $LINE_WIDTH + 1 ))\}"
|
|
then
|
|
if [ -z "${FAIL}" ]
|
|
then
|
|
echo "| error!"
|
|
echo "| Lines must not be longer than ${LINE_WIDTH} characters."
|
|
echo "| "
|
|
echo "| see more https://github.com/paritytech/substrate/blob/master/docs/STYLE_GUIDE.md"
|
|
echo "|"
|
|
FAIL="true"
|
|
fi
|
|
echo "| file: ${file}"
|
|
git diff ${BASE_HASH} -- ${file} \
|
|
| grep -n "^+.\{$(( $LINE_WIDTH + 1))\}"
|
|
echo "|"
|
|
else
|
|
if git diff ${BASE_HASH} -- ${file} | grep -q "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}"
|
|
then
|
|
if [ -z "${FAIL}" ]
|
|
then
|
|
echo "| warning!"
|
|
echo "| Lines should be longer than ${GOOD_LINE_WIDTH} characters only in exceptional circumstances!"
|
|
echo "| "
|
|
echo "| see more https://github.com/paritytech/substrate/blob/master/docs/STYLE_GUIDE.md"
|
|
echo "|"
|
|
fi
|
|
echo "| file: ${file}"
|
|
git diff ${BASE_HASH} -- ${file} | grep -n "^+.\{$(( $GOOD_LINE_WIDTH + 1 ))\}"
|
|
echo "|"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
test -z "${FAIL}"
|
|
)
|