Skip to content
Agentmart
Submit a tool

cpp-tscancode

TscanCode静态分析技能:使用TscanCode(腾讯开源)进行C/C++代码质量分析,检测缺陷、安全漏洞和代码风格问题

Skill by hellyguo

IndexedApache-2.0★ 8
Write a review

Chalk Labs

Need help deploying cpp-tscancode?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hellyguo-cpp-tscancode

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

TscanCode静态分析技能:使用TscanCode(腾讯开源)进行C/C++代码质量分析,检测缺陷、安全漏洞和代码风格问题

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Shell scripts

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/cpp-tscancode

What's inside

Skill name
cpp-tscancode
Description
TscanCode静态分析技能:使用TscanCode(腾讯开源)进行C/C++代码质量分析,检测缺陷、安全漏洞和代码风格问题
License
Apache-2.0
Instructions
111 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (5)

  • SKILL.md
  • CMakeLists-tscancode.txt · templates/
  • Makefile-tscancode · templates/
  • tscancode-check.sh · templates/
  • tscancode-summary.sh · templates/

SKILL.md (first lines)

# TscanCode C/C++静态分析技能

> 本文件中的 `templates/...` 均指本技能目录下的 `templates/` 子目录。

## 工具位置

```bash
TSCANCODE=${HOME}/app/TscanCode.linux/tscancode
```

## 执行流程

1. **确定源代码路径**:`SRC_DIR=src`(根据项目结构调整)
1. **执行分析**(按需选择级别):

```bash
# 基础检查
$TSCANCODE $SRC_DIR

# 完整检查(含风格、性能、可移植性)
$TSCANCODE --enable=all $SRC_DIR 2> tscancode-full.txt

# 仅警告检查
$TSCANCODE --enable=warning $SRC_DIR 2> tscancode-warning.txt

# 风格和性能检查
$TSCANCODE --enable=style,performance $SRC_DIR 2> tscancode-style.txt
```

1. **指定输出格式**:

```bash
# 文本格式(默认,输出到stderr)
$TSCANCODE --enable=all $SRC_DIR 2> tscancode.txt

# XML格式
$TSCANCODE --enable=all --xml $SRC_DIR 2> tscancode.xml

# 静默模式
$TSCANCODE --quiet --enable=all $SRC_DIR 2> tscancode.txt
```

1. **处理结果**:

```bash
# 统计问题类型
grep -oP '\[.*?\]' tscancode.txt | sort | uniq -c | sort -nr

# 提取高危问题
grep -E '(error|warning):' tscancode.txt
```

## 常用参数

| 参数 | 描述 | 示例 |
| --- | --- | --- |
| `--enable=<id>` | 启用检查类别 | `warning`, `style`, `performance`, `portability`, `information`, `all` |
| `-I <dir>` | 包含目录 | `-I include -I /usr/include` |
| `-D<macro>` | 定义宏 | `-DDEBUG -DNDEBUG` |
| `-U<macro>` | 取消宏定义 | `-UDEBUG` |
| `-j <n>` | 并行检查线程数 | `-j 4` |
| `--quiet` | 静默模式 | `--quiet` |
| `--xml` | XML格式输出 | `--xml` |

## 检查类别

| 类别 | 关键检查项 |
| --- | --- |
| warning | 空指针解引用、数组越界、整数溢出、未初始化变量、内存泄漏、双重释放 |
| style | 冗余代码、复杂表达式、变量作用域、命名规范 |
| performance | 按值传递、冗余拷贝、低效算法 |
| portability | 平台依赖、类型大小假设 |
| information | 缺少包含、配置问题 |
| unusedFunction | 定义但未被调用的函数 |

## 典型场景

| 场景 | 命令 |
| --- | --- |
| 快速检查 | `$TSCANCODE --enable=warning $SRC_DIR 2> tscancode-warning.txt` |
| 完整检查 | `$TSCANCODE --enable=all -j 4 $SRC_DIR 2> tscancode-full.txt` |
| 特定目录 | `$TSCANCODE --enable=all -I include src/core/ 2> tscancode-core.txt` |
| CI集成 | `$TSCANCODE --quiet --enable=warning --xml $SRC_DIR 2> tscancode-report.xml` |
| 宏控制 | `$TSCANCODE --enable=all -DDEBUG $SRC_DIR 2> tscancode-debug.txt` |

## 构建系统集成

模板文件位于 `templates/` 目录:

- `tscancode-check.sh` - Shell脚本封装
- `tscancode-summary.sh` - 摘要报告生成
- `CMakeLists-tscancode.txt` - CMake集成目标
- `Makefile-tscancode` - Makefile集成

## 最佳实践

1. 增量检查:大型项目使用 `-j` 并行加速
2. 分级处理:先修复 error,再处理 warning,最后优化 style
3. 包含路径:确保 `-I` 参数包含所有必要的头文件路径
4. 宏定义:正确设置 `-D` 参数以覆盖所有代码路径
5. CI集成:将 TscanCode 纳入持续集成流程

## 注意事项

1. TscanCode 默认输出到 stderr,需重定向 `2>` 捕获
2. `--enable=all` 会启用 unusedFunction,建议全项目扫描
3. 确保 `-I` 路径正确,否则可能误报缺少包含

---

**技能版本**: 1.0.0 | **适用项目**: C/C++ | **输出位置**: 当前目录 tscancode-*.txt

From hellyguo/self-ai-spec, Apache-2.0.

More from hellyguo/self-ai-spec

Signals

Stars
8
Forks
0
Open issues
0
Last commit (this folder)
Aug 27, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hellyguo

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get cpp-tscancode running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying cpp-tscancode?

CallGet help
Cite this page

cpp-tscancode skill. Agent Mart. https://agentmart.dev/skills/hellyguo-cpp-tscancode (last updated 2026-10-24)