Skip to content

Commit f725c59

Browse files
zhongzhijie1xiaoxiang781216
authored andcommitted
tools/checkpatch.sh: simplify Python file type check.
Use existing is_python_file() helper to replace manual string comparison when checking Python file types. Signed-off-by: zhongzhijie1 <[email protected]>
1 parent 8c4343c commit f725c59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/checkpatch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ is_cmake_file() {
9595
}
9696

9797
format_file() {
98-
if [ ${@##*.} == 'py' ]; then
98+
if [ "$(is_python_file $@)" == "1" ]; then
9999
if command -v black >/dev/null; then
100100
echo "Auto-formatting Python file with black: $@"
101101
setupcfg="${TOOLDIR}/../.github/linters/setup.cfg"

0 commit comments

Comments
 (0)