File tree 3 files changed +9
-5
lines changed
3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 9
9
- 输出:将判断结果输出到` check_result.json ` 文件中,文件内容为` {"usable": true} ` 或` {"usable": false} ` 。
10
10
- ` run_cmd ` :
11
11
- 功能:扫描代码,执行自定义检查器逻辑。
12
- - 输出:按照指定格式,输出结果到` result.json ` 文件中,文件格式:
12
+ - 输出:按照指定格式,输出结果到` RESULT_DIR ` 环境变量指定的目录下的 ` result.json ` 文件中,文件格式:
13
13
```
14
14
[
15
15
{
38
38
## 本地调试步骤
39
39
40
40
1. 修改`test.sh`中的`SOURCE_DIR`环境变量为需要扫描的代码目录。
41
- 2. 按需修改`task_request.json`文件中`task_params`字段的内容,将工具代码中用到的字段替换为实际值。
42
- 3. 命令行`cd`到项目根目录,执行`test.sh`脚本:`bash test.sh`。
41
+ 2. 修改`test.sh`中的`RESULT_DIR`环境变量,指定某个本地目录为结果保存目录。
42
+ 3. 按需修改`task_request.json`文件中`task_params`字段的内容,将工具代码中用到的字段替换为实际值。
43
+ 4. 命令行`cd`到项目根目录,执行`test.sh`脚本:`bash test.sh`。
Original file line number Diff line number Diff line change @@ -216,8 +216,10 @@ def __scan(self):
216
216
}
217
217
]
218
218
219
- # 输出结果到指定的json文件
220
- with open ("result.json" , "w" ) as fp :
219
+ # 输出结果json文件到RESULT_DIR指定的目录下
220
+ result_dir = os .getenv ("RESULT_DIR" , os .getcwd ())
221
+ result_path = os .path .join (result_dir , "result.json" )
222
+ with open (result_path , "w" ) as fp :
221
223
json .dump (result , fp , indent = 2 )
222
224
223
225
def __check_usable (self ):
Original file line number Diff line number Diff line change 1
1
export SOURCE_DIR=" /xxx/xxx"
2
+ export RESULT_DIR=" /xxx/xxx"
2
3
export TASK_REQUEST=" task_request.json"
3
4
4
5
echo " - * - * - * - * - * - * - * - * - * - * - * - * -* -* -* -* -* -* -"
You can’t perform that action at this time.
0 commit comments