mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 01:01:27 +00:00
.github/workflows, scripts: Improve checkpatch compliance
Use checkpatch --strict to detect more style issues.
This commit is contained in:
2
.github/workflows/checkpatch_pull.yml
vendored
2
.github/workflows/checkpatch_pull.yml
vendored
@@ -47,7 +47,7 @@ jobs:
|
||||
for commit in $commits; do
|
||||
echo "Running checkpatch.pl for commit $commit"
|
||||
echo "========================================"
|
||||
git format-patch -1 --stdout $commit | ./checkpatch.pl --no-tree --show-types --ignore="${ignore_str// /,}" - || err=1
|
||||
git format-patch -1 --stdout $commit | ./checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" - || err=1
|
||||
echo
|
||||
done
|
||||
|
||||
|
||||
2
.github/workflows/checkpatch_push.yml
vendored
2
.github/workflows/checkpatch_push.yml
vendored
@@ -45,4 +45,4 @@ jobs:
|
||||
)
|
||||
ignore_str=${ignore[*]}
|
||||
|
||||
git format-patch -1 --stdout | ./checkpatch.pl --no-tree --show-types --ignore="${ignore_str// /,}" -
|
||||
git format-patch -1 --stdout | ./checkpatch.pl --no-tree --show-types --strict --ignore="${ignore_str// /,}" -
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ignore=(
|
||||
CONSTANT_COMPARISON
|
||||
LINUX_VERSION_CODE
|
||||
LONG_LINE
|
||||
LONG_LINE_COMMENT
|
||||
LONG_LINE_STRING
|
||||
RETURN_VOID
|
||||
SPDX_LICENSE_TAG
|
||||
SYMBOLIC_PERMS
|
||||
CONSTANT_COMPARISON
|
||||
LINUX_VERSION_CODE
|
||||
LONG_LINE
|
||||
LONG_LINE_COMMENT
|
||||
LONG_LINE_STRING
|
||||
RETURN_VOID
|
||||
SPDX_LICENSE_TAG
|
||||
SYMBOLIC_PERMS
|
||||
)
|
||||
../linux-kernel/scripts/checkpatch.pl -f --show-types --ignore="$(echo "${ignore[@]}" | sed 's/ /,/g')" $(list-source-files | grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/') | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/'
|
||||
ignore_str=${ignore[*]}
|
||||
|
||||
src_files=$(list-source-files | grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/')
|
||||
|
||||
../linux-kernel/scripts/checkpatch.pl -f --show-types --strict --ignore="${ignore_str// /,}" $src_files | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/'
|
||||
|
||||
@@ -231,7 +231,7 @@ function run_checkpatch {
|
||||
if [ "${multiple_patches}" = "false" ]; then
|
||||
echo "Running checkpatch on the SCST kernel patch ..."
|
||||
( cd "${outputdir}/linux-$1" \
|
||||
&& scripts/checkpatch.pl --no-tree --no-signoff - < "${patchfile}" &> "${outputfile}")
|
||||
&& scripts/checkpatch.pl --no-tree --no-signoff --strict - < "${patchfile}" &> "${outputfile}")
|
||||
else
|
||||
echo "Running checkpatch on the SCST kernel patches ..."
|
||||
rm -f "${outputfile}"
|
||||
@@ -239,17 +239,21 @@ function run_checkpatch {
|
||||
&& for p in "${outputdir}/${patchdir}"/*
|
||||
do
|
||||
echo "==== $p" >>"${outputfile}"
|
||||
scripts/checkpatch.pl --no-tree --no-signoff - < "$p" >> "${outputfile}" 2>&1
|
||||
scripts/checkpatch.pl --no-tree --no-signoff --strict - < "$p" >> "${outputfile}" 2>&1
|
||||
done
|
||||
)
|
||||
fi
|
||||
|
||||
errors=$(grep -c '^ERROR' "${outputfile}")
|
||||
warnings=$(grep -c '^WARNING' "${outputfile}")
|
||||
echo "${errors} errors / ${warnings} warnings."
|
||||
grep -E '^WARNING|^ERROR' "${outputfile}" |
|
||||
checks=$(grep -c '^CHECK' "${outputfile}")
|
||||
|
||||
echo "${errors} errors / ${warnings} warnings / ${checks} checks."
|
||||
|
||||
grep -E '^WARNING|^ERROR|^CHECK' "${outputfile}" |
|
||||
sort |
|
||||
grep -v 'WARNING: missing space after return type' |
|
||||
sed 's/^WARNING: Avoid CamelCase:.*/WARNING: Avoid CamelCase/' |
|
||||
sed 's/^CHECK: Avoid CamelCase:.*/CHECK: Avoid CamelCase/' |
|
||||
uniq -c
|
||||
else
|
||||
echo "Skipping checkpatch step for kernel $1."
|
||||
|
||||
Reference in New Issue
Block a user