fix: forcequit for result status

This commit is contained in:
李衍志523370910113 2024-11-07 23:03:18 +08:00
parent de5a4cd9cb
commit 9a547d3608
5 changed files with 53 additions and 34 deletions

View File

@ -11,8 +11,8 @@ from joj3_config_generator.lib.task import (
)
from joj3_config_generator.models import joj1, repo, result, task
from joj3_config_generator.lib.task import (
fix_comment,
fix_diff,
fix_dummy,
fix_keyword,
fix_result_detail,
get_conf_stage,
@ -45,7 +45,7 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config:
executor_with_config, cached = get_executorWithConfig(task_stage, cached)
conf_stage = get_conf_stage(task_stage, executor_with_config)
conf_stage = fix_result_detail(task_stage, conf_stage)
conf_stage = fix_comment(task_stage, conf_stage)
conf_stage = fix_dummy(task_stage, conf_stage)
conf_stage = fix_keyword(task_stage, conf_stage)
conf_stage = fix_diff(task_stage, conf_stage)
result_conf.stage.stages.append(conf_stage)

View File

@ -100,7 +100,6 @@ def get_executorWithConfig(
return (executor_with_config, cached)
# FIXME: fix severity and "keywords"
def fix_keyword(
task_stage: task.Stage, conf_stage: result.StageDetail
) -> result.StageDetail:
@ -167,23 +166,27 @@ def fix_result_detail(
return conf_stage
def fix_comment(
def fix_dummy(
task_stage: task.Stage, conf_stage: result.StageDetail
) -> result.StageDetail:
comment_parser = [
dummy_parser = [
"dummy",
"result-status",
"cpplint",
] # FIXME: determine where cpplint should be
]
if task_stage.parsers is not None:
for parser in task_stage.parsers:
if parser in comment_parser:
comment_parser_ = next(
p for p in conf_stage.parsers if p.name == parser
)
if getattr(task_stage, parser.replace("-", "_"), None) is not None:
comment_parser_.with_.update(
getattr(task_stage, parser.replace("-", "_"))
if parser in dummy_parser:
dummy_parser_ = next(p for p in conf_stage.parsers if p.name == parser)
if (
getattr(task_stage, parser.replace("-", "_"), None) is not None
) and (task_stage.result_status is not None):
dummy_parser_.with_.update(
{
"score": task_stage.result_status.score,
"comment": task_stage.result_status.comment,
"forceQuitOnNotAccepted": task_stage.result_status.forcequit,
}
)
else:
continue

View File

@ -14,6 +14,8 @@ class ParserResultDetail(BaseModel):
class ParserDummy(BaseModel):
comment: Optional[str] = ""
score: Optional[int] = 0
forcequit: Optional[bool] = True
class ParserKeyword(BaseModel):

View File

@ -18,7 +18,7 @@
"/<function",
"get_temp_directory",
"at",
"0x7efe709e4180>/repo-health-checker",
"0x7fa86726c180>/repo-health-checker",
"-root=.",
"-repoSize=50.5",
"-meta=main.py",
@ -70,8 +70,8 @@
"cpuRateLimit": 0,
"cpuSetLimit": "",
"copyIn": {
"//tmp/repo-checker-d89rnuip/repo-health-checker": {
"src": "//tmp/repo-checker-tk3cqa0k/repo-health-checker",
"//tmp/repo-checker-va9ba49a/repo-health-checker": {
"src": "//tmp/repo-checker-e82nkuo4/repo-health-checker",
"content": null,
"fileId": null,
"name": null,
@ -246,13 +246,17 @@
{
"name": "dummy",
"with": {
"comment": "\n\n### Details\n"
"score": 1,
"comment": "Congratulations! Your code compiled successfully.",
"forceQuitOnNotAccepted": false
}
},
{
"name": "result-status",
"with": {
"comment": "Congratulations! Your code compiled successfully."
"score": 1,
"comment": "Congratulations! Your code compiled successfully.",
"forceQuitOnNotAccepted": false
}
}
]
@ -367,7 +371,9 @@
{
"name": "dummy",
"with": {
"comment": ""
"score": 10000,
"comment": "Manuel Charlemagne",
"forceQuitOnNotAccepted": true
}
},
{
@ -504,7 +510,9 @@
{
"name": "dummy",
"with": {
"comment": "\n\n### Details\n"
"score": 0,
"comment": "",
"forceQuitOnNotAccepted": true
}
},
{
@ -631,7 +639,9 @@
{
"name": "dummy",
"with": {
"comment": "\n\n### Details\n"
"score": 0,
"comment": "",
"forceQuitOnNotAccepted": true
}
},
{
@ -727,16 +737,9 @@
{
"name": "cpplint",
"with": {
"keyword": [
"runtime",
"readability",
"build"
],
"weight": [
10,
20,
15
],
"score": 0,
"comment": "",
"forceQuitOnNotAccepted": true,
"matches": [
{
"keywords": [
@ -762,7 +765,9 @@
{
"name": "dummy",
"with": {
"comment": "\n\n### Details\n"
"score": 0,
"comment": "",
"forceQuitOnNotAccepted": true
}
},
{
@ -1013,7 +1018,9 @@
{
"name": "dummy",
"with": {
"comment": "\n\n### Details\n"
"score": 0,
"comment": "",
"forceQuitOnNotAccepted": true
}
},
{
@ -1264,7 +1271,9 @@
{
"name": "dummy",
"with": {
"comment": "\n\n### Details\n"
"score": 0,
"comment": "",
"forceQuitOnNotAccepted": true
}
},
{

View File

@ -15,6 +15,8 @@ limit.stderr = 128
# compile parsers
parsers = [ "result-detail", "dummy", "result-status" ]
result-status.comment = "Congratulations! Your code compiled successfully."
result-status.score = 1
result-status.forcequit = false
dummy.comment = "\n\n### Details\n"
result-detail.exitstatus = true
result-detail.stderr = true
@ -33,6 +35,9 @@ result-detail.exitstatus = true
result-detail.stderr = true
result-detail.time = false
result-detail.mem = false
result-status.comment = "Manuel Charlemagne"
result-status.score = 10000
result-status.forcequit = true
[[stages]]
name = "Clang-tidy checks"