赞
踩
搭建一套持续集成系统,覆盖代码格式规范、静态检查、代码覆盖率、ut环境、内存泄漏检测等,通过vscode集成开发。
# pull docker image and run.
$ docker pull yagerfgcs/rtms:v0.1
$ cd {work_dir} # cd to workdir
$ docker run --name rtms_dbg --privileged --net=host -v `pwd`:/tmp/rtms -it yagerfgcs/rtms:v0.1 /bin/bash
# Create the docker group.
sudo groupadd docker
# Add your user to the docker group.
sudo usermod -aG docker $USER
# **activate the changes to groups
newgrp docker
参考链接:https://docs.docker.com/engine/install/linux-postinstall/
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", // Resolved by CMake Tools: "program": "${command:cmake.launchTargetPath}", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ { // add the directory where our target was built to the PATHs // it gets resolved by CMake Tools: "name": "PATH", "value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}" }, { "name": "OTHER_VALUE", "value": "Something something" } ], "console": "externalTerminal", "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
- 注意需配置kits
![在这里插入图片描述](https://img-blog.csdnimg.cn/958d5fe135604de28b03af9416230cc5.png)
$ find / -name *clang-format*
/root/.vscode-server/extensions/ms-vscode.cpptools-1.13.2-linux-x64/LLVM/bin/clang-format
/root/.vscode-server/extensions/xaver.clang-format-1.9.0
也可以直接修改settings.json文件
{
"clang-format.executable": "/root/.vscode-server/extensions/ms-vscode.cpptools-1.13.2-linux-x64/LLVM/bin/clang-format",
"clang-format.fallbackStyle": "LLVM",
"C_Cpp.clang_format_path": "${workspace}/.clang-format",
}
ps:如果不想使用插件的clang-format,可以升级yum源再单独安装,方法参考:https://blog.csdn.net/shenmingxueIT/article/details/122125191
将通用format文件放到vs的workspace目录下
通用的.clang-format模板,可通过命令生成。
clang-format -style=Google -dump-config > .clang-format
具体静态扫描的方法:
在具体文件,右键–>“Format Document”
背景
使用google代码规范时可以使用cpplint脚本检查。
方法:
执行方式
# 检查具体文件
python cpplint.py ./test.cpp
# 检查整个目录
python cpplint.py ./*.cpp
[root@docker-desktop ~]# echo $PATH
/root/.vscode-server/bin/64bbfbf67ada9953918d72e1df2f4d8e537d340e/bin/remote-cli:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/bin:/root/bin:/tmp/cppcheck-2.9/bin
"clang.executable": "/opt/rh/llvm-toolset-7/root/usr/bin/clang"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。