Skip to content

Commit ade2fb9

Browse files
style: format code with Prettier and StandardJS
This commit fixes the style issues introduced in 8f14220 according to the output from Prettier and StandardJS. Details: None
1 parent 8f14220 commit ade2fb9

1 file changed

Lines changed: 25 additions & 21 deletions

File tree

docs/SonarQube本地开发全流程指南(2025最新).md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
## 3. 三种核心使用方式对比
2121

2222
| 方式 | 实时性 | 报告完整度 | 覆盖率 | 质量门 | 推荐场景 |
23-
|----------------------|--------|------------|--------|--------|--------------------------|
24-
| SonarLint 实时绑定 | ★★★★★ | ★★★★☆ | 支持 | 不支持 | 日常写代码、快速发现问题 |
25-
| sonar-scanner 命令行 | ★☆☆☆☆ | ★★★★★ | 支持 | 支持 | 提交前、PR 前正式检查 |
26-
| VS Code 一键任务 | ★★☆☆☆ | ★★★★★ | 支持 | 支持 | 懒人终极方案(强烈推荐) |
23+
| -------------------- | ------ | ---------- | ------ | ------ | ------------------------ |
24+
| SonarLint 实时绑定 | ★★★★★ | ★★★★☆ | 支持 | 不支持 | 日常写代码、快速发现问题 |
25+
| sonar-scanner 命令行 | ★☆☆☆☆ | ★★★★★ | 支持 | 支持 | 提交前、PR 前正式检查 |
26+
| VS Code 一键任务 | ★★☆☆☆ | ★★★★★ | 支持 | 支持 | 懒人终极方案(强烈推荐) |
2727

2828
## 4. 方式一:SonarLint 实时分析(写代码即出报告)
2929

@@ -68,7 +68,7 @@ sonar-scanner.bat
6868

6969
### 5.2 方式二:纯命令行(最快)
7070

71-
``` shell
71+
```shell
7272
# 1. 生成覆盖率报告(React 示例)
7373
npm test -- --coverage --watchAll=false
7474

@@ -107,27 +107,31 @@ sonar-scanner -Dsonar.token=
107107
```
108108

109109
package.json 加上脚本:
110+
110111
```json
111112
"scripts": {
112113
"test:coverage": "react-scripts test --coverage --watchAll=false"
113114
}
114115
```
116+
115117
以后永远只按 Ctrl+Shift+B → 选择任务即可!
116118

117119
## 6. 查看报告
120+
118121
http://localhost:9000/dashboard?id=pro-react-admin
119122

120123
## 7. 常见问题秒解
121124

122-
| 问题 | 解决方案 |
123-
|---|---|
124-
|扫描卡住|检查 token / 防火墙 / localhost:9000 是否可访问|
125-
|覆盖率 0%|确认 coverage/lcov.info 已生成|
126-
|项目没出现|第一次扫描自动创建,刷新页面|
127-
|连接到 activate.navicat.com|删除 hosts 错误记录 或加 sonar.search.host=127.0.0.1|
128-
|Java 模块错误| wrapper.conf 加入 --add-opens 参数|
125+
| 问题 | 解决方案 |
126+
| --------------------------- | ---------------------------------------------------- |
127+
| 扫描卡住 | 检查 token / 防火墙 / localhost:9000 是否可访问 |
128+
| 覆盖率 0% | 确认 coverage/lcov.info 已生成 |
129+
| 项目没出现 | 第一次扫描自动创建,刷新页面 |
130+
| 连接到 activate.navicat.com | 删除 hosts 错误记录 或加 sonar.search.host=127.0.0.1 |
131+
| Java 模块错误 | wrapper.conf 加入 --add-opens 参数 |
129132

130133
## 8. 多语言额外配置(追加到 sonar-project.properties)
134+
131135
```shell
132136
# properties# Java
133137
sonar.java.source=21
@@ -141,12 +145,12 @@ sonar.go.coverage.reportPaths=coverage.out
141145
## 9. 终极进阶
142146

143147
- 质量门(Quality Gate)
144-
Administration → Quality Gates → Create
145-
示例:Coverage < 80% / New Bugs > 0 → Fail
146-
147-
- 生产环境推荐配置(sonar.properties 追加)
148-
```shell
149-
propertiessonar.web.javaOpts=-Xmx4g
150-
sonar.search.javaOpts=-Xmx4g
151-
sonar.ce.javaOpts=-Xmx4g
152-
```
148+
Administration → Quality Gates → Create
149+
示例:Coverage < 80% / New Bugs > 0 → Fail
150+
151+
- 生产环境推荐配置(sonar.properties 追加)
152+
```shell
153+
propertiessonar.web.javaOpts=-Xmx4g
154+
sonar.search.javaOpts=-Xmx4g
155+
sonar.ce.javaOpts=-Xmx4g
156+
```

0 commit comments

Comments
 (0)