-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue: 1310745 Add jenkins style verification
Codying style check is based on LLVM clang-format tool. Signed-off-by: Igor Ivanov <igor.ivanov.va@gmail.com>
- Loading branch information
1 parent
ca1fc73
commit 7a08a94
Showing
4 changed files
with
115 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,47 @@ | ||
--- | ||
# BasedOnStyle: LLVM | ||
AccessModifierOffset: -4 | ||
ConstructorInitializerIndentWidth: 4 | ||
AlignEscapedNewlinesLeft: false | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakTemplateDeclarations: false | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BreakBeforeBinaryOperators: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BinPackParameters: true | ||
ColumnLimit: 100 | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
DerivePointerBinding: false | ||
ExperimentalAutoDetectBinPacking: false | ||
IndentCaseLabels: false | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 60 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerBindsToType: false | ||
SpacesBeforeTrailingComments: 1 | ||
Cpp11BracedListStyle: false | ||
Standard: Cpp03 | ||
IndentWidth: 4 | ||
TabWidth: 4 | ||
UseTab: Never | ||
BreakBeforeBraces: Attach | ||
IndentFunctionDeclarationAfterType: false | ||
SpacesInParentheses: false | ||
SpacesInAngles: false | ||
SpaceInEmptyParentheses: false | ||
SpacesInCStyleCastParentheses: false | ||
SpaceAfterControlStatementKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
ContinuationIndentWidth: 4 | ||
... | ||
|
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,56 @@ | ||
#!/bin/bash -xeEl | ||
|
||
source $(dirname $0)/globals.sh | ||
|
||
do_check_filter "Checking for codying style ..." "on" | ||
|
||
cd $WORKSPACE | ||
|
||
rm -rf $style_dir | ||
mkdir -p $style_dir | ||
cd $style_dir | ||
|
||
test_app="clang-format" | ||
|
||
if [ $(command -v $test_app >/dev/null 2>&1 || echo $?) ]; then | ||
echo can not find $test_app | ||
exit 1 | ||
fi | ||
|
||
style_tap=${WORKSPACE}/${prefix}/style_test.tap | ||
rm -rf $style_tap | ||
ln -sf $WORKSPACE/contrib/jenkins_tests/style.conf $WORKSPACE/.clang-format | ||
|
||
|
||
check_files=$(find $WORKSPACE/src/ -name '*.c' -o -name '*.cpp' -o -name '*.h') | ||
|
||
echo "1..$(echo $check_files | wc -w)" > $style_tap | ||
i=0 | ||
nerrors=0 | ||
|
||
for file in $check_files; do | ||
set +eE | ||
style_diff="${style_dir}/$(basename ${file}).diff" | ||
eval "env $test_app -style=file \ | ||
${file} \ | ||
| diff -u ${file} - | sed -e '1s|-- |--- a/|' -e '2s|+++ -|+++ b/$file|' \ | ||
> ${style_diff} 2>&1" | ||
[ -s ${style_diff} ] | ||
ret=$((1-$?)) | ||
nerrors=$((nerrors+ret)) | ||
set -eE | ||
i=$((i+1)) | ||
|
||
file=$(basename ${file}) | ||
if [ $ret -gt 0 ]; then | ||
echo "not ok $i $file # See: ${file}.diff" >> $style_tap | ||
else | ||
echo "ok $i $file" >> $style_tap | ||
fi | ||
done | ||
|
||
do_archive "${style_dir}/*.diff" | ||
rc=$(($rc+$nerrors)) | ||
|
||
echo "[${0##*/}]..................exit code = $rc" | ||
exit $rc |
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