【发布时间】:2019-06-29 16:04:23
【问题描述】:
我正在为 vscode 设置一个“cppcheck”任务。它可以工作,但问题匹配器无法捕获问题。
我已经尝试过“$gcc”问题匹配器以及一些自定义配置。
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "cppcheck",
"type": "shell",
"command": "cppcheck --template=gcc --enable=style --project=${workspaceFolder}/build/compile_commands.json",
"problemMatcher": "$gcc",
}
]
}
或者这个:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "cppcheck",
"type": "shell",
"command": "cppcheck --template=gcc --enable=warning src/jc_certreq.cpp",
"problemMatcher": {
"owner": "cpp",
"fileLocation": "absolute",
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
例如终端显示这样的错误:
/home/user/workspace/project/myprogram.c:440: error: Memory leak: exts
但它没有出现在“问题”栏中。
【问题讨论】:
标签: visual-studio-code cppcheck vscode-tasks