codecheck_use_record

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

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SSXzKo4g-1628490199204)(/home/guoqiang/.config/Typora/typora-user-images/image-20210808234253131.png)]

(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

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nmrauKSl-1628490199206)(/home/guoqiang/.config/Typora/typora-user-images/image-20210809013628726.png)]

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.html

To view the results in a browser run:
> firefox ./reports_html/index.html
(CodeChecker venv) guoqiang@sun:~/depth_magic_ws/deptrum/build$

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

大江东去浪淘尽千古风流人物

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值