代码风格与静态检测

一、风格检测cpplint

简介:    https://blog.csdn.net/yelu_hong/article/details/83856306

cpplint 源码    https://github.com/google/styleguide/blob/gh-pages/cpplint/cpplint.py

简单使用  python cpplint.py  test.cpp

谷歌c++规范地址: https://zh-google-styleguide.readthedocs.io/en/latest/google-cpp-styleguide/headers/

添加c语言支持: 修改cpplint.py

_valid_extensions = set(['cc', 'h', 'cpp', 'cu', 'cuh', 'c'])

 

二、静态检测

资料:https://blog.csdn.net/qq_34595352/article/details/103194789

TscanCode地址:https://github.com/Tencent/TscanCode

linux编译: 到trank目录执行make

简单使用: 拷贝cfg目录到检测源码目录,执行tscancode --xml ./

 

三、golang静态检测工具

golangci-lint:

https://www.jianshu.com/p/27eefc2467c5?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

golangci-lint run ./...                       //当前目录下所有文件

 

GoMetalinter :

go get -u github.com/alecthomas/gometalinter

gometalinter --install --update

gometalinter ./...

 

goreporter:

四、 函数关系生成

cflow: https://blog.csdn.net/breaksoftware/article/details/75576878?utm_medium=distribute.pc_relevant_bbs_down.none-task--2~all~first_rank_v2~rank_v29-4.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task--2~all~first_rank_v2~rank_v29-4.nonecase

git clone https://github.com/AaronNGray/cflow.git

cflow -T -m main -n *.c > main.txt
wget -c https://github.com/tinyclub/linux-0.11-lab/raw/master/tools/tree2dotx
 cp tree2dotx /usr/sbin/
cat main.txt | tree2dotx > main.dot
yum install graphviz-gd

dot -Tgif main.dot -o main.gif
 dot -Tpng main.dot -o main.png

 

五、其他

c++test

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值