-
Notifications
You must be signed in to change notification settings - Fork 6
/
sonar_scan.sh
executable file
·105 lines (93 loc) · 3.81 KB
/
sonar_scan.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env bash
if [ "$#" -lt 1 ]
then
echo "Error in input parameters! Not find the version of the build."
exit "0"
fi
PROJECT_DIR=$(pwd)
mkdir check && cd check
export CXX="/usr/bin/clang++"
export BUILD_TYPE="Debug"
cmake -j4 ..
clang-tidy ../src/framework/*.cpp ../include/framework/*.hpp ../src/scanner/*.cpp ../include/scanner/*.hpp -checks=*,\
-hicpp-use-auto,\
-modernize-use-auto,\
-google-default-arguments,\
-modernize-redundant-void-arg,\
-llvm-include-order,\
-readability-simplify-boolean-expr,\
-fuchsia-overloaded-operator,\
-fuchsia-default-arguments,\
-google-readability-namespace-comments,\
-llvm-namespace-comment,\
-hicpp-no-array-decay,\
-llvm-header-guard,\
-hicpp-signed-bitwise,\
-cppcoreguidelines-pro-type-reinterpret-cast,\
-cppcoreguidelines-pro-type-const-cast,\
-clang-diagnostic-deprecated-declarations,\
-cppcoreguidelines-pro-bounds-pointer-arithmetic,\
-cppcoreguidelines-pro-bounds-constant-array-index,\
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,\
-cppcoreguidelines-pro-type-vararg,\
-google-runtime-references,\
-misc-misplaced-widening-cast\
-- -std=c++17 > clangTidyReport
scan-build --use-analyzer=${CXX} --show-description -analyze-headers \
-enable-checker alpha.clone.CloneChecker \
-enable-checker alpha.core.BoolAssignment \
-enable-checker alpha.core.CallAndMessageUnInitRefArg \
-enable-checker alpha.core.CastSize \
-enable-checker alpha.core.CastToStruct \
-enable-checker alpha.core.Conversion \
-enable-checker alpha.core.DynamicTypeChecker \
-enable-checker alpha.core.FixedAddr \
-enable-checker alpha.core.IdenticalExpr \
-enable-checker alpha.core.PointerArithm \
-enable-checker alpha.core.PointerSub \
-enable-checker alpha.core.SizeofPtr \
-enable-checker alpha.core.StackAddressAsyncEscape \
-enable-checker alpha.core.TestAfterDivZero \
-enable-checker alpha.cplusplus.DeleteWithNonVirtualDtor \
-enable-checker alpha.cplusplus.IteratorRange \
-enable-checker alpha.cplusplus.MisusedMovedObject \
-enable-checker alpha.cplusplus.UninitializedObject \
-enable-checker alpha.deadcode.UnreachableCode \
-enable-checker alpha.osx.cocoa.DirectIvarAssignment \
-enable-checker alpha.osx.cocoa.DirectIvarAssignmentForAnnotatedFunctions \
-enable-checker alpha.osx.cocoa.InstanceVariableInvalidation \
-enable-checker alpha.osx.cocoa.MissingInvalidationMethod \
-enable-checker alpha.osx.cocoa.localizability.PluralMisuseChecker \
-enable-checker alpha.security.ArrayBoundV2 \
-enable-checker alpha.security.MallocOverflow \
-enable-checker alpha.security.MmapWriteExec \
-enable-checker alpha.security.ReturnPtrRange \
-enable-checker alpha.security.taint.TaintPropagation \
-enable-checker alpha.unix.BlockInCriticalSection \
-enable-checker alpha.unix.Chroot \
-enable-checker alpha.unix.PthreadLock \
-enable-checker alpha.unix.SimpleStream \
-enable-checker alpha.unix.Stream \
-enable-checker alpha.unix.cstring.BufferOverlap \
-enable-checker alpha.unix.cstring.NotNullTerminated \
-enable-checker alpha.unix.cstring.OutOfBounds \
-plist -o analyzer_reports make -j4
build-wrapper-linux-x86-64 --out-dir output make -j4
sonar-scanner \
-Dsonar.projectKey=Protocol-Analyzer \
-Dsonar.projectName="Protocol Analyzer" \
-Dsonar.projectVersion="$1" \
-Dsonar.cfamily.threads=3 \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.language=cpp \
-Dsonar.cpp.std=c++17 \
-Dsonar.cxx.clangtidy.reportPath=clangTidyReport \
-Dsonar.cxx.clangsa.reportPath=analyzer_reports/*/*.plist \
-Dsonar.issuesReport.html.enable=true \
-Dsonar.projectBaseDir=${PROJECT_DIR} \
-Dsonar.sources=src/framework,include/framework,src/scanner,include/scanner,test \
-Dsonar.cfamily.build-wrapper-output=output \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=vitaliy-grigoriev-github \
-Dsonar.login=d421338a22460d731e2db7b8f7af57647547f8ee
cd .. && rm -rf check