WIP: commit msg parser #39

Closed
周赵嘉程521432910016 wants to merge 24 commits from commit-parser into master
Showing only changes of commit a186c63d76 - Show all commits

View File

@ -121,23 +121,27 @@ func commitMsgToConf() (conf Conf, err error) {
switch head { switch head {
case "feat", "fix", "refactor", "perf", "test", "build", "revert": case "feat", "fix", "refactor", "perf", "test", "build", "revert":
if len(words) < 2 { // TODO: Decide strategy to give students error
return Conf{}, fmt.Errorf("error: hw not assigned") // if len(words) < 2 {
// return Conf{}, fmt.Errorf("error: hw not assigned")
// }
if len(words) >= 2 {
hw = words[1]
if err = validateHw(hw); err == nil {
file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1)
}
} }
hw = words[1]
if err = validateHw(hw); err != nil {
return
}
file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1)
case "joj", "grading": case "joj", "grading":
if len(words) < 2 { // TODO: Decide strategy to give students error
return Conf{}, fmt.Errorf("error: hw not assigned") // if len(words) < 2 {
// return Conf{}, fmt.Errorf("error: hw not assigned")
// }
if len(words) >= 2 {
hw = words[1]
if err = validateHw(hw); err == nil {
file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1)
}
} }
hw = words[1]
if err = validateHw(hw); err != nil {
return
}
file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1)
} }
conf, err = parseConfFile(file) conf, err = parseConfFile(file)