-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
374 additions
and
100 deletions.
There are no files selected for viewing
150 changes: 150 additions & 0 deletions
150
__tests__/github/renderer/__snapshots__/make-mark.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`github renderer make-mark convertToDingMarkdown: convertToDingMarkdown 1`] = ` | ||
"#### [coderabbitai\\[bot\\]](https://github.com/apps/coderabbitai) created [review comment](https://github.com/opensumi/core/pull/4026#discussion_r1766221614) on [pull request](https://github.com/opensumi/core/pull/4026) | ||
#### [#4026 fix: use async in watch file changes](https://github.com/opensumi/core/pull/4026) | ||
--- | ||
> \\[!TIP] | ||
> Codebase Verification | ||
**建议移除未使用的常量 FRAME\\_FOUR,保留 FRAME\\_FIVE。** | ||
经过验证,发现: | ||
* \`FRAME_FOUR\` 常量在代码库中除了定义外没有被使用。建议将其移除,以减少不必要的代码。 | ||
* \`FRAME_FIVE\` 常量在 \`packages/file-service/src/node/recursive/file-service-watcher.ts\` 文件中被使用,用于 throttle 函数的实现。应当保留此常量。 | ||
建议采取的行动: | ||
* 删除 \`packages/utils/src/async.ts\` 文件中的 \`FRAME_FOUR\` 常量定义。 | ||
* 保留 \`FRAME_FIVE\` 常量,因为它在项目中有实际用途。 | ||
<details> | ||
<summary>Analysis chain</summary> | ||
**检查新增常量在代码库中的使用情况。** | ||
新增的 \`FRAME_FOUR\` 和 \`FRAME_FIVE\` 常量本身没有问题,但需要检查它们在代码库中是否被实际使用到。如果只是添加了常量而没有在任何地方引用,那么这些常量的存在就没有太大意义,反而会增加代码的理解难度。 | ||
运行以下脚本检查常量的使用情况: | ||
如果搜索结果只有常量的定义而没有其他引用,那么建议移除这两个目前没有被使用的常量。 | ||
</details> | ||
<details> | ||
<summary>Scripts executed</summary> | ||
The following scripts were executed for the analysis: | ||
Script: | ||
\`\`\`shell | ||
#!/bin/bash | ||
# 检查 FRAME_FOUR 和 FRAME_FIVE 常量的使用情况 | ||
# 在 .ts 和 .js 文件中搜索对 FRAME_FOUR 的使用 | ||
rg --type ts --type js $'FRAME_FOUR' | ||
# 在 .ts 和 .js 文件中搜索对 FRAME_FIVE 的使用 | ||
rg --type ts --type js $'FRAME_FIVE' | ||
\`\`\` | ||
Length of output: 466 | ||
</details> | ||
" | ||
`; | ||
|
||
exports[`github renderer make-mark parse and make 1`] = ` | ||
"# GFM | ||
## Autolink literals | ||
[www.example.com](http://www.example.com), <https://example.com>, and <[email protected]>. | ||
## Footnote | ||
A note[^1] | ||
[^1]: Big note. | ||
## Strikethrough | ||
~~one~~ or ~~two~~ tildes. | ||
## Table | ||
| a | b | c | d | | ||
| - | :- | -: | :-: | | ||
## Tasklist | ||
* [ ] to do | ||
* [x] done | ||
" | ||
`; | ||
|
||
exports[`github renderer make-mark parse and make with code 1`] = ` | ||
"#### [coderabbitai\\[bot\\]](https://github.com/apps/coderabbitai) created [review comment](https://github.com/opensumi/core/pull/4026#discussion_r1766221614) on [pull request](https://github.com/opensumi/core/pull/4026) | ||
#### [#4026 fix: use async in watch file changes](https://github.com/opensumi/core/pull/4026) | ||
--- | ||
> \\[!TIP] | ||
> Codebase Verification | ||
**建议移除未使用的常量 FRAME\\_FOUR,保留 FRAME\\_FIVE。** | ||
经过验证,发现: | ||
* \`FRAME_FOUR\` 常量在代码库中除了定义外没有被使用。建议将其移除,以减少不必要的代码。 | ||
* \`FRAME_FIVE\` 常量在 \`packages/file-service/src/node/recursive/file-service-watcher.ts\` 文件中被使用,用于 throttle 函数的实现。应当保留此常量。 | ||
建议采取的行动: | ||
* 删除 \`packages/utils/src/async.ts\` 文件中的 \`FRAME_FOUR\` 常量定义。 | ||
* 保留 \`FRAME_FIVE\` 常量,因为它在项目中有实际用途。 | ||
<details> | ||
<summary>Analysis chain</summary> | ||
**检查新增常量在代码库中的使用情况。** | ||
新增的 \`FRAME_FOUR\` 和 \`FRAME_FIVE\` 常量本身没有问题,但需要检查它们在代码库中是否被实际使用到。如果只是添加了常量而没有在任何地方引用,那么这些常量的存在就没有太大意义,反而会增加代码的理解难度。 | ||
运行以下脚本检查常量的使用情况: | ||
如果搜索结果只有常量的定义而没有其他引用,那么建议移除这两个目前没有被使用的常量。 | ||
</details> | ||
<details> | ||
<summary>Scripts executed</summary> | ||
The following scripts were executed for the analysis: | ||
Script: | ||
\`\`\`shell | ||
#!/bin/bash | ||
# 检查 FRAME_FOUR 和 FRAME_FIVE 常量的使用情况 | ||
# 在 .ts 和 .js 文件中搜索对 FRAME_FOUR 的使用 | ||
rg --type ts --type js $'FRAME_FOUR' | ||
# 在 .ts 和 .js 文件中搜索对 FRAME_FIVE 的使用 | ||
rg --type ts --type js $'FRAME_FIVE' | ||
\`\`\` | ||
Length of output: 466 | ||
</details> | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# GFM | ||
|
||
## Autolink literals | ||
|
||
[www.example.com](http://www.example.com), <https://example.com>, and <[email protected]>. | ||
|
||
## Footnote | ||
|
||
A note[^1] | ||
|
||
[^1]: Big note. | ||
|
||
## Strikethrough | ||
|
||
~~one~~ or ~~two~~ tildes. | ||
|
||
## Table | ||
|
||
| a | b | c | d | | ||
| --- | :-- | --: | :-: | | ||
|
||
## Tasklist | ||
|
||
- [ ] to do | ||
- [x] done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { readFile } from 'fs/promises'; | ||
import path from 'path'; | ||
|
||
import { convertToDingMarkdown } from '@/github/dingtalk'; | ||
import { replaceGitHubText } from '@/github/gfm'; | ||
import { parseMarkdown, makeMarkdown } from '@/github/renderer/make-mark'; | ||
|
||
describe('github renderer make-mark', () => { | ||
it('parse and make', async () => { | ||
const md = await readFile(path.join(__dirname, './gfm.md'), 'utf-8'); | ||
const parsed = parseMarkdown(md); | ||
const made = makeMarkdown(parsed); | ||
expect(made).toMatchSnapshot(); | ||
}); | ||
it('parse and make with code', async () => { | ||
let md = await readFile( | ||
path.join(__dirname, './review_comment_created.md'), | ||
'utf-8', | ||
); | ||
|
||
md = replaceGitHubText(md); | ||
const parsed = parseMarkdown(md); | ||
const made = makeMarkdown(parsed); | ||
expect(made).toMatchSnapshot(); | ||
}); | ||
|
||
it('convertToDingMarkdown', async () => { | ||
const md = await readFile( | ||
path.join(__dirname, './review_comment_created.md'), | ||
'utf-8', | ||
); | ||
const made = convertToDingMarkdown('', md); | ||
expect(made.markdown.text).toMatchSnapshot('convertToDingMarkdown'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#### [coderabbitai\[bot\]](https://github.com/apps/coderabbitai) created [review comment](https://github.com/opensumi/core/pull/4026#discussion_r1766221614) on [pull request](https://github.com/opensumi/core/pull/4026) | ||
|
||
#### [#4026 fix: use async in watch file changes](https://github.com/opensumi/core/pull/4026) | ||
|
||
--- | ||
|
||
> [!TIP] | ||
> Codebase Verification | ||
**建议移除未使用的常量 FRAME_FOUR,保留 FRAME_FIVE。** | ||
|
||
经过验证,发现: | ||
|
||
- `FRAME_FOUR` 常量在代码库中除了定义外没有被使用。建议将其移除,以减少不必要的代码。 | ||
- `FRAME_FIVE` 常量在 `packages/file-service/src/node/recursive/file-service-watcher.ts` 文件中被使用,用于 throttle 函数的实现。应当保留此常量。 | ||
|
||
建议采取的行动: | ||
|
||
- 删除 `packages/utils/src/async.ts` 文件中的 `FRAME_FOUR` 常量定义。 | ||
- 保留 `FRAME_FIVE` 常量,因为它在项目中有实际用途。 | ||
|
||
<details> | ||
<summary>Analysis chain</summary> | ||
|
||
**检查新增常量在代码库中的使用情况。** | ||
|
||
新增的 `FRAME_FOUR` 和 `FRAME_FIVE` 常量本身没有问题,但需要检查它们在代码库中是否被实际使用到。如果只是添加了常量而没有在任何地方引用,那么这些常量的存在就没有太大意义,反而会增加代码的理解难度。 | ||
|
||
运行以下脚本检查常量的使用情况: | ||
|
||
如果搜索结果只有常量的定义而没有其他引用,那么建议移除这两个目前没有被使用的常量。 | ||
|
||
</details> | ||
|
||
<details> | ||
<summary>Scripts executed</summary> | ||
|
||
The following scripts were executed for the analysis: | ||
|
||
Script: | ||
|
||
```shell | ||
#!/bin/bash | ||
# 检查 FRAME_FOUR 和 FRAME_FIVE 常量的使用情况 | ||
|
||
# 在 .ts 和 .js 文件中搜索对 FRAME_FOUR 的使用 | ||
rg --type ts --type js $'FRAME_FOUR' | ||
|
||
# 在 .ts 和 .js 文件中搜索对 FRAME_FIVE 的使用 | ||
rg --type ts --type js $'FRAME_FIVE' | ||
|
||
``` | ||
|
||
Length of output: 466 | ||
|
||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.