fix: use default conf if anything fail
This commit is contained in:
parent
e8506eeb51
commit
a186c63d76
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user