dev #10

Merged
李衍志523370910113 merged 238 commits from dev into master 2025-03-05 16:20:39 +08:00
5 changed files with 55 additions and 34 deletions
Showing only changes of commit 69aa2a0f77 - Show all commits

View File

@ -2,8 +2,8 @@ from typing import List
from joj3_config_generator.lib.repo import getHealthcheckConfig
from joj3_config_generator.lib.task import (
fix_comment,
fix_diff,
fix_dummy,
fix_keyword,
fix_result_detail,
get_conf_stage,
@ -36,7 +36,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)
jon-lee marked this conversation as resolved Outdated

where is it used?

where is it used?

this should be storing all the files that are about to be copy in or out

this should be storing all the files that are about to be copy in or out

It is as the input and output for the following functions about parsers

It is as the input and output for the following functions about parsers

so this feature is not implemented?

so this feature is not implemented?
    if not repo_conf.force_skip_health_check_on_test or not current_test:
        result_conf.stage.stages.append(get_health_check_config(repo_conf))
    cached: List[str] = []
    # Convert each stage in the task configuration
    for task_stage in task_conf.stages:
        executor_with_config, cached = get_executor_with_config(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_dummy(task_stage, conf_stage)
        conf_stage = fix_keyword(task_stage, conf_stage)
        conf_stage = fix_file(task_stage, conf_stage)
        conf_stage = fix_diff(task_stage, conf_stage, task_conf)
        result_conf.stage.stages.append(conf_stage)

it is

    for task_stage in task_conf.stages:
        executor_with_config, cached = get_executor_with_config(task_stage, cached)

this is a loop, so this cached will be updated in every round of stage

```python if not repo_conf.force_skip_health_check_on_test or not current_test: result_conf.stage.stages.append(get_health_check_config(repo_conf)) cached: List[str] = [] # Convert each stage in the task configuration for task_stage in task_conf.stages: executor_with_config, cached = get_executor_with_config(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_dummy(task_stage, conf_stage) conf_stage = fix_keyword(task_stage, conf_stage) conf_stage = fix_file(task_stage, conf_stage) conf_stage = fix_diff(task_stage, conf_stage, task_conf) result_conf.stage.stages.append(conf_stage) ``` it is ```python for task_stage in task_conf.stages: executor_with_config, cached = get_executor_with_config(task_stage, cached) ``` this is a loop, so this `cached` will be updated in every round of stage

The return value is unnecessary.

The return value is unnecessary.

I have a lazing coding style here, everything has get imported would get exported, so should maintain this until the end of the loop. Everything is exported in previous stage would be imported in the next stage.

I have a lazing coding style here, everything has get imported would get exported, so should maintain this until the end of the loop. Everything is exported in previous stage would be imported in the next stage.
  1. The return value is unnecessary
  2. It should be a set
1. The return value is unnecessary 2. It should be a `set`

try it yourself

try it yourself

I see why

I see why

resolved.

resolved.
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

@ -107,7 +107,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:
@ -172,21 +171,27 @@ def fix_result_detail(task_stage: TaskStage, conf_stage: ResultStage) -> ResultS
return conf_stage
def fix_comment(task_stage: TaskStage, conf_stage: ResultStage) -> ResultStage:
comment_parser = [
def fix_dummy(
task_stage: task.Stage, conf_stage: result.StageDetail
) -> result.StageDetail:
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"