-
Notifications
You must be signed in to change notification settings - Fork 8
0. 关于
williamfzc edited this page Oct 26, 2022
·
4 revisions
这个项目定位是底层基础组件,将源码逻辑化。 简单来说就是,诸如哪个文件的哪个片段对应到什么函数、类等等。
基于这一点,大多数上层工具都可以基于它而:
- 不再需要兼容多语言
- 不再需要苦恼如何从源码中提取扫描想要的信息
- 不依赖编译流程
before:
func ExtractFunction(targetFile string, config *ExtractConfig) ([]*extractor.FunctionFileResult, error) {
// ...
}
after:
默认格式是json,方便后续处理:
{
"path": "extract.go",
"language": "GOLANG",
"type": "func",
"units": [
{
"name": "ExtractFunction",
"receiver": "",
"parameters": [
{
"type": "string",
"name": "targetFile"
},
{
"type": "*ExtractConfig",
"name": "config"
}
],
"returns": [
{
"type": "[]*extractor.FunctionFileResult",
"name": ""
},
{
"type": "error",
"name": ""
}
],
"span": {
"start": {
"row": 18,
"column": 0
},
"end": {
"row": 46,
"column": 1
}
},
"extras": null
}
]
}
当然也可以直接把它当库使用,详见右侧的使用章节。
优异的性能表现使得它可以被放在devops链的任何地方(这也是我放弃 sibyl 1 的原因之一),去做甚至全仓扫描。 得到的代码快照将能够很好支撑后续阶段的行为。
可以发挥你的想象力把它用在各种各样的地方:
- 自定逻辑的静态代码扫描
- 精准测试
- 仓库分析
- git diff 升级版
- ...
可以在侧边栏查看其他资料。