Skip to contentSkip to conversation

travis: Enforce kernel coding style on rdma-core

RFC PATCH New Leon Romanovsky 1 participant 1 message Jul 15, 2017 InfiniBand

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 travis: Enforce kernel coding style on rdma-core

The rdma-core library is tightly coupled to the linux-rdma kernel and developed mostly by the same kernel developers. Enforcement of the same coding style as used for kernel development has potential to reduce errors and improve readability.

Despite the fact that checkpatch is written as general tool, the differences between kernel and user space requires from us to skip kernel types, file movement and execute permissions checks.

---
I checked it and it works correctly on man pages, markdown, debian and redhat sepfic files.
https://github.com/linux-rdma/rdma-core/pull/168
https://travis-ci.org/linux-rdma/rdma-core/builds/253870106?utm_source=github_status&utm_medium=notification

Thanks

---
 .travis.yml                       |  1 +
 buildlib/const_structs.checkpatch |  0
 buildlib/travis-checkpatch        | 14 ++++++++++++++
 3 files changed, 15 insertions(+)
 create mode 100644 buildlib/const_structs.checkpatch
 create mode 100755 buildlib/travis-checkpatch
.travis.yml +1 -0
index e72ff9d2..c63ac962 100644
@@ -49,6 +49,7 @@ before_script:
   - rm $LATEST_GCC_LINARO_TAR
 script:
   - buildlib/travis-build
+  - buildlib/travis-checkpatch
   - buildlib/github-release
 deploy:
   # Deploy assets to Github releases
buildlib/const_structs.checkpatch new file +0 -0
new file mode 100644
index 00000000..e69de29b
buildlib/travis-checkpatch new file +14 -0
new file mode 100755
index 00000000..50e5d67e
@@ -0,0 +1,14 @@
+#!/bin/bash
+# Copyright 2017 Mellanox Technologies Ltd.
+# Licensed under BSD (MIT variant) or GPLv2. See COPYING.
+
+set -e
+
+if [ $TRAVIS_COMMIT_RANGE != "" ]; then
+	cd buildlib/
+	wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/checkpatch.pl
+	wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/scripts/spelling.txt
+	DIR_FOR_PATCHES_TO_CHECK=$(mktemp -d)
+	git format-patch --no-cover-letter $TRAVIS_COMMIT_RANGE -o $DIR_FOR_PATCHES_TO_CHECK/
+	perl checkpatch.pl --no-tree --ignore PREFER_KERNEL_TYPES,FILE_PATH_CHANGES,EXECUTE_PERMISSIONS $DIR_FOR_PATCHES_TO_CHECK/*
+fi

--
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html