codecheck_use_record
生活随笔
收集整理的這篇文章主要介紹了
codecheck_use_record
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- Step 1: Integrate CodeChecker into your build system
- Step 2: Analyze your code
- Step 3: Run the analysis
- Step 4: View the analysis results in the command line
- Step 5: Hint: You can do the 1st and the 2nd step in one round by executing `check`
- step 6: Export the reports as static HTML files
Step 1: Integrate CodeChecker into your build system
source ~/codechecker/venv/bin/activate
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ make clean
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ codechecker log --build "make depth_magic" --output ./compile_commands.json
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ codechecker log --build "make depth_magic" --output ./compile_commands.json
Step 2: Analyze your code
Once the build is logged successfully and the compile_commands.json was created, you can analyze your project.
Step 3: Run the analysis
CodeChecker analyze ./compile_commands.json --enable sensitive --output ./reports
commond line
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ codechecker analyze ./compile_commands.json --enable sensitive --output ./reports
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ codechecker analyze ./compile_commands.json --enable sensitive --output ./reports
cause reports files
The ./reports directory is the “database” of CodeChecker that allows to manage further working steps.
Step 4: View the analysis results in the command line
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ codechecker parse ./reports/
Step 5: Hint: You can do the 1st and the 2nd step in one round by executing check
cd <repo root dir>/docs/examples
make clean
CodeChecker check --build "make" --output ./reports --clean \--enable sensitive
or to run on 22 threads both the compilation and the analysis:
CodeChecker check --jobs 22 --build "make clean ; make --jobs 22" \--output ./reports --clean --enable sensitive
step 6: Export the reports as static HTML files
You can visualize the results as static HTML by executing
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$ codechecker parse -e html ./reports/ -o ./reports_html
result show:
google-build-using-namespace | STYLE | 54
google-explicit-constructor | MEDIUM | 1134
google-global-names-in-headers | STYLE | 3
google-runtime-int | LOW | 695
google-runtime-references | STYLE | 2006
misc-forwarding-reference-overload | LOW | 8
misc-incorrect-roundings | HIGH | 58
misc-macro-parentheses | MEDIUM | 384
misc-misplaced-const | LOW | 9
misc-misplaced-widening-cast | HIGH | 7
misc-redundant-expression | MEDIUM | 19
misc-sizeof-container | HIGH | 3
misc-sizeof-expression | HIGH | 5
misc-suspicious-enum-usage | HIGH | 4
misc-unconventional-assign-operator | MEDIUM | 174
misc-unused-using-decls | LOW | 1
modernize-deprecated-headers | LOW | 106
modernize-replace-auto-ptr | LOW | 1
optin.cplusplus.VirtualCall | MEDIUM | 1
performance-faster-string-find | LOW | 5
performance-inefficient-string-concatenation | LOW | 1
performance-inefficient-vector-operation | LOW | 2
performance-move-const-arg | MEDIUM | 5
performance-move-constructor-init | MEDIUM | 1
performance-noexcept-move-constructor | MEDIUM | 44
performance-type-promotion-in-math-fn | LOW | 1
performance-unnecessary-copy-initialization | LOW | 4
performance-unnecessary-value-param | LOW | 113
security.FloatLoopCounter | MEDIUM | 8
unix.API | MEDIUM | 1
unix.Malloc | MEDIUM | 1
----------------------------------------------------------------------------------==== Severity Statistics ====----
----------------------------
Severity | Number of reports
----------------------------
HIGH | 132
MEDIUM | 2068
LOW | 2332
STYLE | 2063
----------------------------To view statistics in a browser run:
> firefox ./reports_html/statistics.htmlTo view the results in a browser run:
> firefox ./reports_html/index.html
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$
總結(jié)
以上是生活随笔為你收集整理的codecheck_use_record的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【C++】random随机数与【C++1
- 下一篇: “神仙信有之”下一句是什么