This commit is contained in:
parent
9652ef9b78
commit
779fcaa63c
|
@ -1,5 +1,5 @@
|
|||
from joj3_config_generator.lib.repo import getHealthcheckConfig, getTeapotConfig
|
||||
from joj3_config_generator.lib.task import fix_comment, fix_keyword
|
||||
from joj3_config_generator.lib.task import fix_comment, fix_keyword, fix_result_detail
|
||||
from joj3_config_generator.models import (
|
||||
Cmd,
|
||||
CmdFile,
|
||||
|
@ -82,16 +82,10 @@ def convert(repo_conf: Repo, task_conf: Task) -> ResultConfig:
|
|||
ParserConfig(name=parser, with_={}) for parser in task_stage.parsers
|
||||
],
|
||||
)
|
||||
# TODO: fix all parser here
|
||||
if "result-detail" in task_stage.parsers:
|
||||
result_detail_parser = next(
|
||||
p for p in conf_stage.parsers if p.name == "result-detail"
|
||||
)
|
||||
if task_stage.result_detail is not None:
|
||||
result_detail_parser.with_.update(task_stage.result_detail)
|
||||
|
||||
conf_stage = fix_result_detail(task_stage, conf_stage)
|
||||
conf_stage = fix_comment(task_stage, conf_stage)
|
||||
conf_stage = fix_keyword(task_stage, conf_stage)
|
||||
# TODO: fix diff parser here
|
||||
|
||||
result_conf.stage.stages.append(conf_stage)
|
||||
|
||||
|
|
|
@ -20,6 +20,37 @@ def fix_keyword(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
|
|||
return conf_stage
|
||||
|
||||
|
||||
def fix_result_detail(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
|
||||
if "result-detail" in task_stage.parsers:
|
||||
result_detail_parser = next(
|
||||
p for p in conf_stage.parsers if p.name == "result-detail"
|
||||
)
|
||||
if task_stage.result_detail is not None:
|
||||
show_files = []
|
||||
if (
|
||||
task_stage.result_detail.stdout
|
||||
and task_stage.result_detail.stdout is not None
|
||||
):
|
||||
show_files.append("stdout")
|
||||
if (
|
||||
task_stage.result_detail.stderr
|
||||
and task_stage.result_detail.stderr is not None
|
||||
):
|
||||
show_files.append("stderr")
|
||||
result_detail_parser.with_.update(
|
||||
{
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": show_files,
|
||||
"showExitStatus": task_stage.result_detail.exitstatus,
|
||||
"showRuntime": task_stage.result_detail.time,
|
||||
"showMemory": task_stage.result_detail.mem,
|
||||
}
|
||||
)
|
||||
|
||||
return conf_stage
|
||||
|
||||
|
||||
def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
|
||||
comment_parser = [
|
||||
"dummy",
|
||||
|
|
|
@ -45,7 +45,9 @@ class Stage(BaseModel):
|
|||
keyword: Optional[ParserKeyword] = ParserKeyword()
|
||||
clangtidy: Optional[ParserKeyword] = ParserKeyword()
|
||||
cppcheck: Optional[ParserKeyword] = ParserKeyword()
|
||||
cpplint: Optional[ParserKeyword] = ParserKeyword()
|
||||
# FIXME: determine cpplint type
|
||||
# cpplint: Optional[ParserKeyword] = ParserKeyword()
|
||||
cpplint: Optional[ParserDummy] = ParserDummy()
|
||||
result_detail: Optional[ParserResultDetail] = Field(
|
||||
ParserResultDetail(), alias="result-detail"
|
||||
)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"/<function",
|
||||
"get_temp_directory",
|
||||
"at",
|
||||
"0x7ff2358271a0>/repo-health-checker",
|
||||
"0x7fd3bed4f1a0>/repo-health-checker",
|
||||
"-root=.",
|
||||
"-repoSize=50.5",
|
||||
"-meta=main.py",
|
||||
|
@ -71,8 +71,8 @@
|
|||
"cpuRateLimit": 0,
|
||||
"cpuSetLimit": "",
|
||||
"copyIn": {
|
||||
"//tmp/repo-checker-3qi07atp/repo-health-checker": {
|
||||
"src": "//tmp/repo-checker-ebujap5a/repo-health-checker",
|
||||
"//tmp/repo-checker-9z61g608/repo-health-checker": {
|
||||
"src": "//tmp/repo-checker-19d98f6u/repo-health-checker",
|
||||
"content": null,
|
||||
"fileId": null,
|
||||
"name": null,
|
||||
|
@ -238,7 +238,15 @@
|
|||
"mem": false,
|
||||
"stdout": false,
|
||||
"stderr": true,
|
||||
"exitstatus": true
|
||||
"exitstatus": true,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stderr"
|
||||
],
|
||||
"showExitStatus": true,
|
||||
"showRuntime": false,
|
||||
"showMemory": false
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -375,7 +383,15 @@
|
|||
"mem": false,
|
||||
"stdout": false,
|
||||
"stderr": true,
|
||||
"exitstatus": false
|
||||
"exitstatus": false,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stderr"
|
||||
],
|
||||
"showExitStatus": false,
|
||||
"showRuntime": false,
|
||||
"showMemory": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -559,7 +575,15 @@
|
|||
"mem": false,
|
||||
"stdout": true,
|
||||
"stderr": false,
|
||||
"exitstatus": true
|
||||
"exitstatus": true,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stdout"
|
||||
],
|
||||
"showExitStatus": true,
|
||||
"showRuntime": false,
|
||||
"showMemory": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -693,7 +717,15 @@
|
|||
"mem": false,
|
||||
"stdout": false,
|
||||
"stderr": true,
|
||||
"exitstatus": true
|
||||
"exitstatus": true,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stderr"
|
||||
],
|
||||
"showExitStatus": true,
|
||||
"showRuntime": false,
|
||||
"showMemory": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -776,16 +808,7 @@
|
|||
{
|
||||
"name": "cpplint",
|
||||
"with": {
|
||||
"keyword": [
|
||||
"runtime",
|
||||
"readability",
|
||||
"build"
|
||||
],
|
||||
"weight": [
|
||||
10,
|
||||
20,
|
||||
15
|
||||
]
|
||||
"comment": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -801,7 +824,15 @@
|
|||
"mem": false,
|
||||
"stdout": true,
|
||||
"stderr": false,
|
||||
"exitstatus": true
|
||||
"exitstatus": true,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stdout"
|
||||
],
|
||||
"showExitStatus": true,
|
||||
"showRuntime": false,
|
||||
"showMemory": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -894,7 +925,15 @@
|
|||
"mem": true,
|
||||
"stdout": false,
|
||||
"stderr": true,
|
||||
"exitstatus": true
|
||||
"exitstatus": true,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stderr"
|
||||
],
|
||||
"showExitStatus": true,
|
||||
"showRuntime": true,
|
||||
"showMemory": true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -987,7 +1026,15 @@
|
|||
"mem": true,
|
||||
"stdout": false,
|
||||
"stderr": true,
|
||||
"exitstatus": true
|
||||
"exitstatus": true,
|
||||
"score": 0,
|
||||
"comment": "",
|
||||
"showFiles": [
|
||||
"stderr"
|
||||
],
|
||||
"showExitStatus": true,
|
||||
"showRuntime": true,
|
||||
"showMemory": true
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user