style: resolve codefactor issue
This commit is contained in:
parent
8924f174b4
commit
53c794c88c
|
@ -76,37 +76,36 @@ func isIgnored(line string) bool {
|
||||||
return ignoreRegex.MatchString(line)
|
return ignoreRegex.MatchString(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseMessage(line string) ClangMessage {
|
func parseMessage(lineStr string) ClangMessage {
|
||||||
messageRegex := regexp.MustCompile(`^(?P<filepath>.+):(?P<line>\d+):(?P<column>\d+): (?P<level>\S+): (?P<message>.*?) \[(?P<diagnostic_name>[^\]]+)\]?\n$`)
|
messageRegex := regexp.MustCompile(`^(?P<filepath>.+):(?P<line>\d+):(?P<column>\d+): (?P<level>\S+): (?P<message>.*?) \[(?P<diagnostic_name>[^\]]+)\]?\n$`)
|
||||||
regexRes := messageRegex.FindStringSubmatch(line)
|
regexRes := messageRegex.FindStringSubmatch(lineStr)
|
||||||
if len(regexRes) == 0 {
|
if len(regexRes) == 0 {
|
||||||
return *newClangMessage("", 0, 0, UNKNOWN, "", "", nil, nil)
|
return *newClangMessage("", 0, 0, UNKNOWN, "", "", nil, nil)
|
||||||
} else {
|
}
|
||||||
filepath := regexRes[1]
|
filepath := regexRes[1]
|
||||||
line, err := strconv.Atoi(regexRes[2])
|
line, err := strconv.Atoi(regexRes[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
line = 0
|
line = 0
|
||||||
slog.Error("parse line", "error", err)
|
slog.Error("parse line", "error", err)
|
||||||
}
|
}
|
||||||
column, err := strconv.Atoi(regexRes[3])
|
column, err := strconv.Atoi(regexRes[3])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
column = 0
|
column = 0
|
||||||
slog.Error("parse column", "error", err)
|
slog.Error("parse column", "error", err)
|
||||||
}
|
}
|
||||||
level := levelFromString(regexRes[4])
|
level := levelFromString(regexRes[4])
|
||||||
message := regexRes[5]
|
message := regexRes[5]
|
||||||
diagnosticName := regexRes[6]
|
diagnosticName := regexRes[6]
|
||||||
|
|
||||||
return ClangMessage{
|
return ClangMessage{
|
||||||
filepath: filepath,
|
filepath: filepath,
|
||||||
line: line,
|
line: line,
|
||||||
column: column,
|
column: column,
|
||||||
level: level,
|
level: level,
|
||||||
message: message,
|
message: message,
|
||||||
diagnosticName: diagnosticName,
|
diagnosticName: diagnosticName,
|
||||||
detailsLines: make([]string, 0),
|
detailsLines: make([]string, 0),
|
||||||
children: make([]ClangMessage, 0),
|
children: make([]ClangMessage, 0),
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,12 +55,12 @@ func isWhitespace(b byte) bool {
|
||||||
func myersDiff(src, dst []string, compareSpace bool) []operation {
|
func myersDiff(src, dst []string, compareSpace bool) []operation {
|
||||||
n := len(src)
|
n := len(src)
|
||||||
m := len(dst)
|
m := len(dst)
|
||||||
max := n + m
|
maxLength := n + m
|
||||||
var trace []map[int]int
|
var trace []map[int]int
|
||||||
var x, y int
|
var x, y int
|
||||||
|
|
||||||
loop:
|
loop:
|
||||||
for d := 0; d <= max; d += 1 {
|
for d := 0; d <= maxLength; d += 1 {
|
||||||
v := make(map[int]int, d+2)
|
v := make(map[int]int, d+2)
|
||||||
trace = append(trace, v)
|
trace = append(trace, v)
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,8 @@ func getNonAscii(root string) ([]string, error) {
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
if info.Name() == ".git" {
|
if info.Name() == ".git" {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if gitattrExist {
|
if gitattrExist {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user