fix: use default conf if anything fail
This commit is contained in:
		
							parent
							
								
									e8506eeb51
								
							
						
					
					
						commit
						a186c63d76
					
				| 
						 | 
				
			
			@ -121,24 +121,28 @@ func commitMsgToConf() (conf Conf, err error) {
 | 
			
		|||
 | 
			
		||||
	switch head {
 | 
			
		||||
	case "feat", "fix", "refactor", "perf", "test", "build", "revert":
 | 
			
		||||
		if len(words) < 2 {
 | 
			
		||||
			return Conf{}, fmt.Errorf("error: hw not assigned")
 | 
			
		||||
		}
 | 
			
		||||
		// TODO: Decide strategy to give students error
 | 
			
		||||
		// 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 {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
			if err = validateHw(hw); err == nil {
 | 
			
		||||
				file = strings.Replace(file, "conf", "conf-"+hw+"-cq", 1)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	case "joj", "grading":
 | 
			
		||||
		if len(words) < 2 {
 | 
			
		||||
			return Conf{}, fmt.Errorf("error: hw not assigned")
 | 
			
		||||
		}
 | 
			
		||||
		// TODO: Decide strategy to give students error
 | 
			
		||||
		// 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 {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
			if err = validateHw(hw); err == nil {
 | 
			
		||||
				file = strings.Replace(file, "conf", "conf-"+hw+"-oj", 1)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	conf, err = parseConfFile(file)
 | 
			
		||||
	return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user