clang-tidy parser and executor #26
|
@ -1 +1 @@
|
|||
Subproject commit 422868c1c6427ce73e665477b40922c72ccc14e5
|
||||
Subproject commit 580d9c9e20ae887551af2f87483d82cf6efa6f6d
|
|
@ -109,14 +109,14 @@ func group_messages(messages []ClangMessage) []ClangMessage {
|
|||
return grouped_messages
|
||||
}
|
||||
|
||||
func convert_paths_to_relative(messages *[]ClangMessage) {
|
||||
currentDir := "/w"
|
||||
func convert_paths_to_relative(messages *[]ClangMessage, conf Conf) {
|
||||
currentDir := conf.RootDir
|
||||
for i := range *messages {
|
||||
(*messages)[i].filepath, _ = filepath.Rel(currentDir, (*messages)[i].filepath)
|
||||
}
|
||||
}
|
||||
|
||||
func parse_lines(lines []string) []ClangMessage {
|
||||
func parse_lines(lines []string, conf Conf) []ClangMessage {
|
||||
messages := make([]ClangMessage, 0)
|
||||
for _, line := range lines {
|
||||
if is_ignored(string(line)) {
|
||||
|
@ -129,6 +129,6 @@ func parse_lines(lines []string) []ClangMessage {
|
|||
messages = append(messages, message)
|
||||
}
|
||||
}
|
||||
convert_paths_to_relative(&messages)
|
||||
convert_paths_to_relative(&messages, conf)
|
||||
return group_messages(messages)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ type Match struct {
|
|||
}
|
||||
|
||||
type Conf struct {
|
||||
Score int
|
||||
Score int `default:"100"`
|
||||
RootDir string `default:"\\w"`
|
||||
Matches []Match
|
||||
}
|
||||
|
||||
|
@ -24,7 +25,7 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
|||
stdout := executorResult.Files["stdout"]
|
||||
|
||||
lines := strings.SplitAfter(stdout, "\n")
|
||||
messages := parse_lines(lines)
|
||||
messages := parse_lines(lines, conf)
|
||||
formatted_messages := format(messages)
|
||||
|
||||
// TODO: Handle the json file (parse into markdown and delete it?)
|
||||
|
@ -36,6 +37,7 @@ func Parse(executorResult stage.ExecutorResult, conf Conf) stage.ParserResult {
|
|||
encoder.SetIndent("", " ")
|
||||
_ = encoder.Encode(formatted_messages)
|
||||
|
||||
// TODO: Handle unexpected errors from executor
|
||||
// if executorResult.Status != stage.Status(envexec.StatusAccepted) {
|
||||
// return stage.ParserResult{
|
||||
// Score: 0,
|
||||
|
|
Loading…
Reference in New Issue
Block a user