feat(parser): unify default init score = 0 (#73)
This commit is contained in:
		
							parent
							
								
									6a7787a974
								
							
						
					
					
						commit
						5de4c3ee78
					
				|  | @ -14,7 +14,7 @@ type Match struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type Conf struct { | type Conf struct { | ||||||
| 	Score   int    `default:"100"` | 	Score   int | ||||||
| 	RootDir string `default:"/w"` | 	RootDir string `default:"/w"` | ||||||
| 	Matches []Match | 	Matches []Match | ||||||
| 	Stdout  string `default:"stdout"` | 	Stdout  string `default:"stdout"` | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ type Match struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type Conf struct { | type Conf struct { | ||||||
| 	Score   int `default:"100"` | 	Score   int | ||||||
| 	Matches []Match | 	Matches []Match | ||||||
| 	Stdout  string `default:"stdout"` | 	Stdout  string `default:"stdout"` | ||||||
| 	Stderr  string `default:"stderr"` | 	Stderr  string `default:"stderr"` | ||||||
|  |  | ||||||
|  | @ -13,7 +13,8 @@ type Match struct { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| type Conf struct { | type Conf struct { | ||||||
| 	FullScore        int | 	Score            int | ||||||
|  | 	FullScore        int // TODO: remove me
 | ||||||
| 	MinScore         int | 	MinScore         int | ||||||
| 	Files            []string | 	Files            []string | ||||||
| 	ForceQuitOnMatch bool | 	ForceQuitOnMatch bool | ||||||
|  | @ -25,7 +26,7 @@ type Keyword struct{} | ||||||
| func Parse(executorResult stage.ExecutorResult, conf Conf) ( | func Parse(executorResult stage.ExecutorResult, conf Conf) ( | ||||||
| 	stage.ParserResult, bool, | 	stage.ParserResult, bool, | ||||||
| ) { | ) { | ||||||
| 	score := conf.FullScore | 	score := conf.Score | ||||||
| 	comment := "" | 	comment := "" | ||||||
| 	matched := false | 	matched := false | ||||||
| 	for _, file := range conf.Files { | 	for _, file := range conf.Files { | ||||||
|  | @ -54,6 +55,10 @@ func (*Keyword) Run(results []stage.ExecutorResult, confAny any) ( | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, true, err | 		return nil, true, err | ||||||
| 	} | 	} | ||||||
|  | 	// TODO: remove me on FullScore field removed
 | ||||||
|  | 	if conf.FullScore != 0 && conf.Score == 0 { | ||||||
|  | 		conf.Score = conf.FullScore | ||||||
|  | 	} | ||||||
| 	var res []stage.ParserResult | 	var res []stage.ParserResult | ||||||
| 	forceQuit := false | 	forceQuit := false | ||||||
| 	for _, result := range results { | 	for _, result := range results { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user