fix(parser/clangtidy): ignore empty lines
This commit is contained in:
		
							parent
							
								
									e44537ea95
								
							
						
					
					
						commit
						7ff6dfb002
					
				|  | @ -6,6 +6,7 @@ import ( | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 	"strconv" | 	"strconv" | ||||||
|  | 	"strings" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| type Level int | type Level int | ||||||
|  | @ -68,6 +69,9 @@ func levelFromString(levelString string) Level { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func isIgnored(line string) bool { | func isIgnored(line string) bool { | ||||||
|  | 	if strings.TrimSpace(line) == "" { | ||||||
|  | 		return true | ||||||
|  | 	} | ||||||
| 	ignoreRegex := regexp.MustCompile("^error:.*$") | 	ignoreRegex := regexp.MustCompile("^error:.*$") | ||||||
| 	return ignoreRegex.MatchString(line) | 	return ignoreRegex.MatchString(line) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -24,11 +24,6 @@ type ClangTidy struct{} | ||||||
| func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { | func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { | ||||||
| 	stdout := executorResult.Files["stdout"] | 	stdout := executorResult.Files["stdout"] | ||||||
| 	stderr := executorResult.Files["stderr"] | 	stderr := executorResult.Files["stderr"] | ||||||
| 
 |  | ||||||
| 	lines := strings.SplitAfter(stdout, "\n") |  | ||||||
| 	messages := ParseLines(lines, conf) |  | ||||||
| 	formattedMessages := Format(messages) |  | ||||||
| 
 |  | ||||||
| 	if executorResult.Status != stage.Status(envexec.StatusAccepted) { | 	if executorResult.Status != stage.Status(envexec.StatusAccepted) { | ||||||
| 		if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) && | 		if !((executorResult.Status == stage.Status(envexec.StatusNonzeroExitStatus)) && | ||||||
| 			(executorResult.ExitStatus == 1)) { | 			(executorResult.ExitStatus == 1)) { | ||||||
|  | @ -41,6 +36,9 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult { | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	lines := strings.SplitAfter(stdout, "\n") | ||||||
|  | 	messages := ParseLines(lines, conf) | ||||||
|  | 	formattedMessages := Format(messages) | ||||||
| 	score, comment := GetResult(formattedMessages, conf) | 	score, comment := GetResult(formattedMessages, conf) | ||||||
| 	return stage.ParserResult{ | 	return stage.ParserResult{ | ||||||
| 		Score:   score, | 		Score:   score, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user