scripts: checkpatch: Add TAB check

BTW, fix location check.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ib8f07312fd513a34e5d17ef9ce3c9bd2f19f300a
This commit is contained in:
Joseph Chen
2022-09-27 01:08:04 +00:00
parent 844b170f4d
commit 0287fa94cd

View File

@@ -34,12 +34,6 @@ function check_doc()
exit 1
fi
# check new content location
if ! grep -q 'Release Note' ${DIFF_DOC_ALL} ; then
echo "ERROR: ${DOC}: Adding new content at the beginning but not end"
exit 1
fi
TITLE=`sed -n "/^+## /p" ${DIFF_DOC_ALL} | tr -d " +#"`
FILE=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $3 }'`
COMMIT=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $4 }'`
@@ -47,6 +41,19 @@ function check_doc()
HORIZONTAL_LINE=`sed -n "/^+------$/p" ${DIFF_DOC_ALL}`
# echo "### ${COMMIT}, ${SEVERITY}, ${TITLE}, ${FILE}"
# check new content location
if ! git show -1 ${DOC} | grep -q 'Release Note' ; then
echo "ERROR: ${DOC}: Adding new content at the top but not bottom"
exit 1
fi
# check TAB before index of 'New' body
if grep -q $'\t[0-9]' ${DOC} ; then
echo "ERROR: ${DOC}: Don't add TAB before index:"
grep $'\t[0-9]' ${DOC}
exit 1
fi
# check standalone file
if ! echo ${FILE} | grep -q { ; then
if ! git log -1 --name-only | grep -q ${FILE}; then