Skip to content

Commit 789ad15

Browse files
committed
Merge branch 'main' into coref-api
2 parents 4251a1a + e3faf08 commit 789ad15

File tree

11 files changed

+2613
-76
lines changed

11 files changed

+2613
-76
lines changed

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"image": "ghcr.io/lonrun/codefuse-query-tutorial:0.6",
3+
"hostRequirements": {
4+
"cpus": 4
5+
},
6+
"customizations": {
7+
"codespaces": {
8+
"openFiles": [
9+
"tutorial/README.md"
10+
]
11+
},
12+
// Configure properties specific to VS Code.
13+
"vscode": {
14+
// Add the IDs of extensions you want installed when the container is created.
15+
"extensions": [
16+
"ms-toolsai.jupyter",
17+
"MS-CEINTL.vscode-language-pack-zh-hans",
18+
"CodeFuse-Query.codefuse-query-extension"
19+
]
20+
}
21+
}
22+
}

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
<a href="https://github.com/codefuse-ai/CodeFuse-Query/issues">
1717
<img alt="Open Issues" src="https://img.shields.io/github/issues-raw/codefuse-ai/CodeFuse-Query" />
1818
</a>
19+
<a href="https://github.com/codefuse-ai/CodeFuse-Query/releases">
20+
<img alt="Release Download" src="https://img.shields.io/github/downloads/codefuse-ai/CodeFuse-Query/total" />
21+
</a>
22+
<a href="https://marketplace.visualstudio.com/items?itemName=CodeFuse-Query.codefuse-query-extension">
23+
<img alt="VSCode Plugin" src="https://img.shields.io/visual-studio-marketplace/i/CodeFuse-Query.codefuse-query-extension?style=social&logo=visualstudiocode&logoColor=%23007ACC" />
24+
</a>
1925
</p>
2026

2127
## 什么是CodeFuse-Query?
@@ -54,7 +60,7 @@ CodeFuse-Query 包括**Sparrow CLI **和CodeFuse-Query**在线服务Query中心*
5460
注:以上语言状态的成熟程度判断标准是根据COREF包含的信息种类和实际落地情况来进行判定,除了OC/C++外,所有语言均支持了完整的AST信息和Documentation信息,以Java为例,COREF for Java还支持了ASG、Call Graph、Class Hierarchy、以及部分CFG信息。
5561
## 使用场景
5662
### 查询代码特征
57-
小开发同学想知道 Repo A 里面使用了哪些 String 型的变量,所以他写了一个 Godel 如下,交给 CodeFuse-Query 系统给他返回了结果。
63+
小开发同学想知道 Repo A 里面使用了哪些 String 型的变量,所以他写了一个 Gödel 如下,交给 CodeFuse-Query 系统给他返回了结果。
5864
```rust
5965
// script
6066
use coref::java::*
@@ -76,7 +82,7 @@ fn main() {
7682
TL 同学发现团队总是写出很多类似的 Bug A**他想针对 Bug A 制定一个代码规则和其检查器**,并在 CodeReview 阶段做个卡点。小 TL 通过在 CodeFuse-Query 平台上面编写了一段分析 Query,在平台上面测试符合要求,把这段分析 Query 固化下来作为一个代码规则,并上线到了 CodeReview/CI 阶段。从此这个 Bug 再也没发生过了。
7783
类似需求:编写静态缺陷扫描规则进行代码风险拦截。
7884
### 获取统计数据
79-
小研究发现传统的代码复杂度指标很难准确地衡量代码的复杂情况,通过学习国际先进经验加上自我灵光一闪,设计了一套复杂度指标和算法。通过 Godel 实现出来以后,**发现不怎么优化就已经性能非常高了**,很快就应用到了 10 几种语言,11+万个仓库当中去了。马上就对代码仓库整体的复杂度有了深入的了解。相比较以前需要自己解析代码,分析语法树,对接系统,**不知道方便了多少。**
85+
小研究发现传统的代码复杂度指标很难准确地衡量代码的复杂情况,通过学习国际先进经验加上自我灵光一闪,设计了一套复杂度指标和算法。通过 Gödel 实现出来以后,**发现不怎么优化就已经性能非常高了**,很快就应用到了 10 几种语言,11+万个仓库当中去了。马上就对代码仓库整体的复杂度有了深入的了解。相比较以前需要自己解析代码,分析语法树,对接系统,**不知道方便了多少。**
8086
类似需求:代码统计,代码度量,算法设计,学术研究。
8187

8288
## 应用领域
@@ -110,14 +116,18 @@ CodeFuse-Query为CodeFuse代码大模型提供了以下数据清洗能力:
110116
- [引言](./doc/1_abstract.md)
111117
- [概述](./doc/2_introduction.md)
112118
- [安装、配置、运行](./doc/3_install_and_run.md)
113-
- [Godel查询语言介绍](./doc/4_godelscript_language.md)
119+
- [Gödel查询语言介绍](./doc/4_godelscript_language.md)
114120
- [VSCode开发插件](./doc/5_toolchain.md)
115121

122+
## 教程 (tutorial)
123+
- [在线教程](./tutorial/README.md)
124+
116125
## 目录结构说明
117126
- `cli`:命令行工具的入口,提供统一的命令行接口,调用其他模块完成具体功能
118127
- `language`:各语言的数据化核心(extractor)和数据建模(lib)。关于开放度的问题,请参见《关于开源范围的一些说明》章节
119128
- `doc`:参考文档
120-
- `examples`:Godel 查询语言示例
129+
- `examples`:Gödel 查询语言示例
130+
- `tutorial`:CodeFuse-Query 开发容器使用教程
121131

122132
## 关于开源范围的一些说明
123133
截止目前,从源码**不能**构建出可执行的程序,原因在于本次开源并没有开放所有的模块,缺少的模块会在之后的一年陆续开源。尽管如此,为保障完整的体验,我们开放了**完整的安装包**下载,请见Release页面。
@@ -134,3 +144,9 @@ CodeFuse-Query为CodeFuse代码大模型提供了以下数据清洗能力:
134144
| SQL | N | N | BETA |
135145
| Swift | N | N | BETA |
136146
| Properties | N | N | BETA |
147+
148+
## 联系我们
149+
![微信用户群图片](./assets/wechat_qrcode_1214.JPG)
150+
## Star History
151+
152+
[![Star History Chart](https://api.star-history.com/svg?repos=codefuse-ai/CodeFuse-Query&type=Date)](https://star-history.com/#codefuse-ai/CodeFuse-Query&Date)

assets/wechat_qrcode_1214.JPG

226 KB
Loading

cli/extractor/extractor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def __init__(self):
3131

3232

3333
def cfamily_extractor_cmd(source_root, database, options):
34-
cmd = list()
35-
cmd += [str(Extractor.cfamily_extractor)]
36-
cmd += ["--compile-commands=", str(source_root)]
37-
cmd += ["--output-db-path=", str(database)]
38-
return cmd
34+
return [
35+
str(Extractor.cfamily_extractor),
36+
f"--compile-commands={source_root}",
37+
f"--output-db-path={database}"
38+
]
3939

4040

4141
def go_extractor_cmd(source_root, database, options):

0 commit comments

Comments
 (0)