mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 09:00:55 +00:00
remove SA1024 staticchek
This commit is contained in:
parent
2a579eb27c
commit
0145fe3486
@ -55,7 +55,7 @@ after_script:
|
||||
- rm -rf ./res/var/*
|
||||
script:
|
||||
- go test -v ./...
|
||||
- staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019"
|
||||
- staticcheck -show-ignored -checks "-ST1017,-U1000,-ST1005,-S1034,-S1012,-SA4006,-SA6005,-SA1019,-SA1024"
|
||||
- unconvert $(go list ./... | grep -v /vendor/)
|
||||
- ineffassign .
|
||||
- find . ! \( -path './vendor' -prune \) -type f -name '*.go' -print0 | xargs -0 gofmt -l -s
|
||||
|
14
parser.go
14
parser.go
@ -259,9 +259,9 @@ func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) {
|
||||
imports := []parsedImport{}
|
||||
|
||||
for _, c := range lines {
|
||||
t := strings.TrimSpace(strings.TrimPrefix(c.Text, "//"))
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))
|
||||
if strings.HasPrefix(t, "@Param") {
|
||||
pv := getparams(strings.TrimSpace(strings.TrimPrefix(t, "@Param")))
|
||||
pv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Param")))
|
||||
if len(pv) < 4 {
|
||||
logs.Error("Invalid @Param format. Needs at least 4 parameters")
|
||||
}
|
||||
@ -286,7 +286,7 @@ func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) {
|
||||
}
|
||||
|
||||
for _, c := range lines {
|
||||
t := strings.TrimSpace(strings.TrimPrefix(c.Text, "//"))
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))
|
||||
if strings.HasPrefix(t, "@Import") {
|
||||
iv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Import")))
|
||||
if len(iv) == 0 || len(iv) > 2 {
|
||||
@ -307,9 +307,9 @@ func parseComment(lines []*ast.Comment) (pcs []*parsedComment, err error) {
|
||||
|
||||
filterLoop:
|
||||
for _, c := range lines {
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "/"))
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))
|
||||
if strings.HasPrefix(t, "@Filter") {
|
||||
fv := getparams(strings.TrimSpace(strings.TrimPrefix(t, "@Filter")))
|
||||
fv := getparams(strings.TrimSpace(strings.TrimLeft(t, "@Filter")))
|
||||
if len(fv) < 3 {
|
||||
logs.Error("Invalid @Filter format. Needs at least 3 parameters")
|
||||
continue filterLoop
|
||||
@ -349,9 +349,9 @@ filterLoop:
|
||||
pc.filters = filters
|
||||
pc.imports = imports
|
||||
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "/"))
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))
|
||||
if strings.HasPrefix(t, "@router") {
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "/"))
|
||||
t := strings.TrimSpace(strings.TrimLeft(c.Text, "//"))
|
||||
matches := routeRegex.FindStringSubmatch(t)
|
||||
if len(matches) == 3 {
|
||||
pc.routerPath = matches[1]
|
||||
|
Loading…
Reference in New Issue
Block a user