分析 SonarQube 自托管项目、问题过滤、验证 Quality Gate 和自动修复操作的自动解决方案。
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install sonarqube-analyzer或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install sonarqube-analyzer⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/sonarqube-analyzer/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
Analisa projetos no SonarQube self-hosted, obtém issues e sugere soluções automatizadas.
sonar_get_issuesObtém lista de issues de um projeto/PR no SonarQube.
Parâmetros:
projectKey (string, obrigatório): Chave do projetopullRequest (string, opcional): Número da PR para análise específicaseverities (string[], opcional): Severidades a filtrar (BLOCKER, CRITICAL, MAJOR, MINOR, INFO)status (string, opcional): Status das issues (OPEN, CONFIRMED, FALSE_POSITIVE, etc.)limit (number, opcional): Limite de issues (padrão: 100)Exemplo:
{
"projectKey": "openclaw-panel",
"pullRequest": "5",
"severities": ["CRITICAL", "MAJOR"],
"limit": 50
}
sonar_analyze_and_suggestAnalisa issues e sugere soluções com base nas regras do SonarQube.
Parâmetros:
projectKey (string, obrigatório): Chave do projetopullRequest (string, opcional): Número da PRautoFix (boolean, opcional): Tentar aplicar correções automáticas (padrão: false)Exemplo:
{
"projectKey": "openclaw-panel",
"pullRequest": "5",
"autoFix": false
}
sonar_quality_gateVerifica o status do Quality Gate de um projeto.
Parâmetros:
projectKey (string, obrigatório): Chave do projetopullRequest (string, opcional): Número da PRExemplo:
{
"projectKey": "openclaw-panel",
"pullRequest": "5"
}
O skill usa as seguintes configurações do ambiente:
SONAR_HOST_URL=http://127.0.0.1:9000 # URL do SonarQube
SONAR_TOKEN=admin # Token de autenticação
node scripts/analyze.js --project=my-project --pr=5
node scripts/report.js --project=my-project --format=markdown
node scripts/quality-gate.js --project=my-project --pr=5
{
"total": 12,
"issues": [
{
"key": "...",
"severity": "MAJOR",
"component": "apps/web/src/ui/App.tsx",
"line": 346,
"message": "Extract this nested ternary...",
"rule": "typescript:S3358",
"status": "OPEN",
"solution": "Extract nested ternary into a separate function..."
}
],
"summary": {
"BLOCKER": 0,
"CRITICAL": 0,
"MAJOR": 2,
"MINOR": 10,
"INFO": 0
}
}
{
"projectKey": "openclaw-panel",
"analysis": {
"totalIssues": 12,
"fixableAutomatically": 8,
"requiresManualFix": 4
},
"suggestions": [
{
"file": "apps/web/src/ui/App.tsx",
"line": 346,
"issue": "Nested ternary operation",
"suggestion": "Extract into independent component",
"codeExample": "...",
"autoFixable": false
}
],
"nextSteps": [
"Run lint:fix for auto-fixable issues",
"Refactor nested ternaries in App.tsx",
"Replace || with ?? operators"
]
}
| Regra | Problema | Solução Automática | |-------|----------|-------------------| | S6606 | Use \|\| instead of ?? | ✅ Substituir por ?? | | S3358 | Nested ternary | ❌ Requer refatoração manual | | S6749 | Redundant fragment | ✅ Remover fragment | | S6759 | Non-readonly props | ✅ Adicionar readonly | | S3776 | Cognitive complexity | ❌ Requer extração de componentes | | S6571 | any in union type | ✅ Remover redundância |
Exemplo de uso em GitHub Actions:
- name: Analyze with SonarQube Skill
run: |
npm install -g @felipeoff/sonarqube-analyzer
sonarqube-analyzer \
--project=my-project \
--pr=${{ github.event.pull_request.number }} \
--suggest-fixes安装 声纳分析仪 后,可以对 AI 说这些话来触发它
Help me get started with Sonarqube Analyzer
Explains what Sonarqube Analyzer does, walks through the setup, and runs a quick demo based on your current project
Use Sonarqube Analyzer to analisa projetos SonarQube self-hosted, obtém issues filtradas, ver...
Invokes Sonarqube Analyzer with the right parameters and returns the result directly in the conversation
What can I do with Sonarqube Analyzer in my marketing & growth workflow?
Lists the top use cases for Sonarqube Analyzer, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/sonarqube-analyzer/ 目录(个人级,所有项目可用),或 .claude/skills/sonarqube-analyzer/(项目级)。重启 AI 客户端后,用 /sonarqube-analyzer 主动调用,或让 AI 根据上下文自动发现并使用。
声纳分析仪 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
声纳分析仪 可免费安装使用。请查阅仓库了解许可证信息。
分析 SonarQube 自托管项目、问题过滤、验证 Quality Gate 和自动修复操作的自动解决方案。
声纳分析仪 属于「Marketing & Growth」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my marketing & growth tasks using Sonarqube Analyzer
Identifies repetitive steps in your workflow and sets up Sonarqube Analyzer to handle them automatically