← 返回
数据分析 Key 中文

Sonarqube Analyzer

Analisa projetos SonarQube self-hosted, obtém issues filtradas, verifica Quality Gate e sugere soluções automatizadas com opção de auto-fix.
对自托管 SonarQube 项目进行分析,获取筛选后的问题,检查 Quality Gate 并提供自动修复方案。
felipeoff
数据分析 clawhub v0.1.2 1 版本 99837.8 Key: 需要
★ 1
Stars
📥 1,826
下载
💾 23
安装
1
版本
#latest

概述

SonarQube Analyzer Skill

Analisa projetos no SonarQube self-hosted, obtém issues e sugere soluções automatizadas.

Ferramentas Registradas

sonar_get_issues

Obtém lista de issues de um projeto/PR no SonarQube.

Parâmetros:

  • projectKey (string, obrigatório): Chave do projeto
  • pullRequest (string, opcional): Número da PR para análise específica
  • severities (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_suggest

Analisa issues e sugere soluções com base nas regras do SonarQube.

Parâmetros:

  • projectKey (string, obrigatório): Chave do projeto
  • pullRequest (string, opcional): Número da PR
  • autoFix (boolean, opcional): Tentar aplicar correções automáticas (padrão: false)

Exemplo:

{
  "projectKey": "openclaw-panel",
  "pullRequest": "5",
  "autoFix": false
}

sonar_quality_gate

Verifica o status do Quality Gate de um projeto.

Parâmetros:

  • projectKey (string, obrigatório): Chave do projeto
  • pullRequest (string, opcional): Número da PR

Exemplo:

{
  "projectKey": "openclaw-panel",
  "pullRequest": "5"
}

Configuração

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

Uso

Analisar uma PR específica:

node scripts/analyze.js --project=my-project --pr=5

Gerar relatório de issues:

node scripts/report.js --project=my-project --format=markdown

Verificar Quality Gate:

node scripts/quality-gate.js --project=my-project --pr=5

Estrutura de Resposta

sonar_get_issues

{
  "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
  }
}

sonar_analyze_and_suggest

{
  "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"
  ]
}

Soluções Automáticas Disponíveis

RegraProblemaSolução Automática
------------------------------------
S6606Use `\\ instead of ??`✅ Substituir por ??
S3358Nested ternary❌ Requer refatoração manual
S6749Redundant fragment✅ Remover fragment
S6759Non-readonly props✅ Adicionar readonly
S3776Cognitive complexity❌ Requer extração de componentes
S6571any in union type✅ Remover redundância

Requisitos

  • Node.js 18+
  • Acesso ao SonarQube (localhost:9000)
  • Token de autenticação configurado

Integração com Workflows

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

版本历史

共 1 个版本

  • v0.1.2 当前
    2026-03-28 20:10 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 64,989
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 367 📥 140,201
content-creation

Ant Design Skill

felipeoff
使用 Ant Design v5+ 高效构建 React UI 的技能,涵盖布局、表单、表格、模态框、通过 ConfigProvider 实现主题配置以及一致的组件模式。
★ 3 📥 2,381