forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support cpplint code style checker (vesoft-inc#81)
- Loading branch information
1 parent
015a731
commit 1d1172d
Showing
3 changed files
with
6,287 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2018 - present, VE Software Inc. All rights reserved | ||
# | ||
# This source code is licensed under Apache 2.0 License | ||
# (found in the LICENSE.Apache file in the root directory) | ||
|
||
PROJECT_PATH=$(cd `dirname $0`; pwd) | ||
PROJECT_NAME="${PROJECT_PATH##*/}" | ||
CPPLINT_FILE=$PROJECT_PATH"/../../cpplint/cpplint.py" | ||
|
||
if [ $# -eq 0 ];then | ||
CHECK_FILES=$(git diff --name-only HEAD) | ||
else | ||
CHECK_FILES=$(find $1 -not \( -path src/CMakeFiles -prune \) -not \( -path src/interface/gen-cpp2 -prune \) -name "*.[h]" -o -name "*.cpp" | grep -v 'GraphScanner.*' | grep -v 'GraphParser.*') | ||
fi | ||
|
||
CPPLINT_EXTENS=cpp,h | ||
CPPLINT_FITER=-whitespace/indent,-build/include_what_you_use,-readability/todo,-build/include,-build/header_guard | ||
python $CPPLINT_FILE --extensions=$CPPLINT_EXTENS --filter=$CPPLINT_FITER --linelength=100 $CHECK_FILES 2>&1 | ||
|
||
result=$? | ||
if [ $result -eq 0 ] | ||
then | ||
exit 0 | ||
else | ||
echo "cpplint code style check failed, please fix and recommit." | ||
exit 1 | ||
fi |
Oops, something went wrong.