diff --git a/backend/plugins/gitee/tasks/issue_extractor.go b/backend/plugins/gitee/tasks/issue_extractor.go index 175fd7a5a64..5f20ec8fadb 100644 --- a/backend/plugins/gitee/tasks/issue_extractor.go +++ b/backend/plugins/gitee/tasks/issue_extractor.go @@ -177,43 +177,22 @@ func ExtractApiIssues(taskCtx plugin.SubTaskContext) errors.Error { IssueId: giteeIssue.GiteeId, LabelName: label.Name, }) - if issueSeverityRegex != nil { - groups := issueSeverityRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - giteeIssue.Severity = groups[0] - } + if issueSeverityRegex != nil && issueSeverityRegex.MatchString(label.Name) { + giteeIssue.Severity = label.Name } - - if issueComponentRegex != nil { - groups := issueComponentRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - giteeIssue.Component = groups[0] - } - } - - if issuePriorityRegex != nil { - groups := issuePriorityRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - giteeIssue.Priority = groups[0] - } + if issueComponentRegex != nil && issueComponentRegex.MatchString(label.Name) { + giteeIssue.Component = label.Name } - - if issueTypeBugRegex != nil { - if ok := issueTypeBugRegex.MatchString(label.Name); ok { - giteeIssue.Type = ticket.BUG - } - } - - if issueTypeRequirementRegex != nil { - if ok := issueTypeRequirementRegex.MatchString(label.Name); ok { - giteeIssue.Type = ticket.REQUIREMENT - } + if issuePriorityRegex != nil && issuePriorityRegex.MatchString(label.Name) { + giteeIssue.Priority = label.Name } - if issueTypeIncidentRegex != nil { - if ok := issueTypeIncidentRegex.MatchString(label.Name); ok { - giteeIssue.Type = ticket.INCIDENT - } + if issueTypeRequirementRegex != nil && issueTypeRequirementRegex.MatchString(label.Name) { + giteeIssue.Type = ticket.REQUIREMENT + } else if issueTypeBugRegex != nil && issueTypeBugRegex.MatchString(label.Name) { + giteeIssue.Type = ticket.BUG + } else if issueTypeIncidentRegex != nil && issueTypeIncidentRegex.MatchString(label.Name) { + giteeIssue.Type = ticket.INCIDENT } } results = append(results, giteeIssue) diff --git a/backend/plugins/gitee/tasks/pr_extractor.go b/backend/plugins/gitee/tasks/pr_extractor.go index 462fe2e5d8d..94b84c271e6 100644 --- a/backend/plugins/gitee/tasks/pr_extractor.go +++ b/backend/plugins/gitee/tasks/pr_extractor.go @@ -124,19 +124,12 @@ func ExtractApiPullRequests(taskCtx plugin.SubTaskContext) errors.Error { LabelName: label.Name, }) // if pr.Type has not been set and prType is set in .env, process the below - if labelTypeRegex != nil { - groups := labelTypeRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - giteePr.Type = groups[0] - } + if labelTypeRegex != nil && labelTypeRegex.MatchString(label.Name) { + giteePr.Type = label.Name } - // if pr.Component has not been set and prComponent is set in .env, process - if labelComponentRegex != nil { - groups := labelComponentRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - giteePr.Component = groups[0] - } + if labelComponentRegex != nil && labelComponentRegex.MatchString(label.Name) { + giteePr.Component = label.Name } } results = append(results, giteePr) diff --git a/backend/plugins/github/e2e/snapshot_tables/_tool_github_issues.csv b/backend/plugins/github/e2e/snapshot_tables/_tool_github_issues.csv index 933af4374aa..556adb7eafb 100644 --- a/backend/plugins/github/e2e/snapshot_tables/_tool_github_issues.csv +++ b/backend/plugins/github/e2e/snapshot_tables/_tool_github_issues.csv @@ -1,23 +1,23 @@ connection_id,github_id,repo_id,number,state,title,body,priority,type,author_id,author_name,assignee_id,assignee_name,milestone_id,lead_time_minutes,url,closed_at,github_created_at,github_updated_at,severity,component,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark -1,346842831,134018330,5,closed," chinese <-p.freeSignal chinese ","""Hi,\r\n chinese , chinese `<-p.freeSignal` chinese 。 chinese ,freeSignal chinese , chinese `putWorker` chinese `p.freeSignal <- sig{}`\r\n\r\n chinese \r\n```\r\nfunc (p *Pool) getWorker() *Worker {\r\n\tvar w *Worker\r\n\twaiting := false\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n < 0 { // chinese pool chinese worker chinese \r\n\t\twaiting = p.Running() >= p.Cap()\r\n\t} else { // chinese pool chinese worker\r\n\t\t<-p.freeSignal \r\n\t\tw = idleWorkers[n] \r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t}\r\n\tp.lock.Unlock()\r\n\r\n\r\nfunc (p *Pool) Release() error {\r\n\tp.once.Do(func() { // chinese \r\n\t\tp.release <- sig{}\r\n\t\tp.lock.Lock()\r\n\t\tidleWorkers := p.workers\r\n\t\tfor i, w := range idleWorkers {\r\n\t\t\t<-p.freeSignal\r\n\t\t\tw.task <- nil\r\n\t\t\tidleWorkers[i] = nil\r\n\t\t}\r\n\t\tp.workers = nil\r\n\t\tp.lock.Unlock()\r\n\t})\r\n\treturn nil\r\n}\r\n\r\n```\r\n\r\n chinese `<-p.freeSignal`, chinese putWorker chinese ? chinese putWorker chinese , chinese , chinese idleWorkers chinese worker chinese \r\n\r\n chinese ? chinese """,,question,8605102,pathbox,0,,7856149,2182,https://github.com/panjf2000/ants/issues/5,2018-08-03T15:32:00.000+00:00,2018-08-02T03:09:57.000+00:00,2018-08-10T04:06:36.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,11, +1,346842831,134018330,5,closed," chinese <-p.freeSignal chinese ","""Hi,\r\n chinese , chinese `<-p.freeSignal` chinese 。 chinese ,freeSignal chinese , chinese `putWorker` chinese `p.freeSignal <- sig{}`\r\n\r\n chinese \r\n```\r\nfunc (p *Pool) getWorker() *Worker {\r\n\tvar w *Worker\r\n\twaiting := false\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n < 0 { // chinese pool chinese worker chinese \r\n\t\twaiting = p.Running() >= p.Cap()\r\n\t} else { // chinese pool chinese worker\r\n\t\t<-p.freeSignal \r\n\t\tw = idleWorkers[n] \r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t}\r\n\tp.lock.Unlock()\r\n\r\n\r\nfunc (p *Pool) Release() error {\r\n\tp.once.Do(func() { // chinese \r\n\t\tp.release <- sig{}\r\n\t\tp.lock.Lock()\r\n\t\tidleWorkers := p.workers\r\n\t\tfor i, w := range idleWorkers {\r\n\t\t\t<-p.freeSignal\r\n\t\t\tw.task <- nil\r\n\t\t\tidleWorkers[i] = nil\r\n\t\t}\r\n\t\tp.workers = nil\r\n\t\tp.lock.Unlock()\r\n\t})\r\n\treturn nil\r\n}\r\n\r\n```\r\n\r\n chinese `<-p.freeSignal`, chinese putWorker chinese ? chinese putWorker chinese , chinese , chinese idleWorkers chinese worker chinese \r\n\r\n chinese ? chinese """,,,8605102,pathbox,0,,7856149,2182,https://github.com/panjf2000/ants/issues/5,2018-08-03T15:32:00.000+00:00,2018-08-02T03:09:57.000+00:00,2018-08-10T04:06:36.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,11, 1,347255859,134018330,6,closed," chinese bug","""func (p *Pool) getWorker() *Worker chinese 199 chinese \r\n chinese , chinese \r\n\r\n\tp.lock.Unlock()\r\n\t\t<-p.freeSignal\r\n\t\tp.lock.Lock()""",,bug,13118848,lovelly,0,,7856149,1786,https://github.com/panjf2000/ants/issues/6,2018-08-04T10:18:41.000+00:00,2018-08-03T04:32:28.000+00:00,2018-08-04T10:18:41.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,12, 1,348630179,134018330,7,closed," chinese ",""" chinese , chinese 。 chinese ants chinese , chinese 。 chinese \r\n![image](https://user-images.githubusercontent.com/4555057/43823431-98384444-9b21-11e8-880c-7458b931734a.png)\r\n chinese periodicallyPurge chinese \r\n![image](https://user-images.githubusercontent.com/4555057/43823534-e3c624a8-9b21-11e8-96c6-512e3e08db22.png)\r\n\r\n### chinese \r\n\r\n chinese n==0 chinese \r\n```\r\nif n > 0 {\r\n\tn++\r\n\tp.workers = idleWorkers[n:]\r\n}\r\n```\r\n\r\n\r\n### chinese \r\n```\r\npackage main\r\n\r\nimport (\r\n\t\""github.com/panjf2000/ants\""\r\n\t\""fmt\""\r\n\t\""time\""\r\n\t\""strconv\""\r\n)\r\n\r\nfunc main() {\r\n\r\n\tpool,err := ants.NewPool(100000)\r\n\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tfor i:=0;i<10000;i++{\r\n\t\tpool.Submit(\r\n\t\t\tfunc() error {\r\n\t\t\t\ttime.Sleep(1 * time.Millisecond)\r\n\t\t\t\tfmt.Println(strconv.Itoa(i))\r\n\t\t\t\treturn nil\r\n\t\t\t})\r\n\t}\r\n\r\n\tfor{\r\n\t\tpool.Submit(\r\n\t\t\tfunc() error {\r\n\t\t\t\ttime.Sleep(10 * time.Millisecond)\r\n\t\t\treturn nil\r\n\t\t})\r\n\t\ttime.Sleep(1 * time.Millisecond)\r\n\t}\r\n}\r\n```""",,bug,4555057,huiwq1990,0,,7856149,2602,https://github.com/panjf2000/ants/issues/7,2018-08-10T04:06:04.000+00:00,2018-08-08T08:43:15.000+00:00,2018-08-10T04:06:04.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,13, -1,356703393,134018330,10,closed," chinese worker chinese ",""" chinese cpu chinese ?""",,question,11763614,Moonlight-Zhao,0,,7856149,36198,https://github.com/panjf2000/ants/issues/10,2018-09-29T11:45:00.000+00:00,2018-09-04T08:26:55.000+00:00,2018-09-29T11:45:00.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,16, +1,356703393,134018330,10,closed," chinese worker chinese ",""" chinese cpu chinese ?""",,,11763614,Moonlight-Zhao,0,,7856149,36198,https://github.com/panjf2000/ants/issues/10,2018-09-29T11:45:00.000+00:00,2018-09-04T08:26:55.000+00:00,2018-09-29T11:45:00.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,16, 1,364361014,134018330,12,closed," chinese , chinese tag chinese ",""" chinese dep chinese , chinese ants chinese , chinese tag chinese 。 chinese tag 3.6 chinese ed55924 chinese ,git chinese af376f1b chinese , chinese 5 chinese , chinese , chinese tag chinese 。( chinese )""",,,29452204,edcismybrother,0,,7856149,1293,https://github.com/panjf2000/ants/issues/12,2018-09-28T06:05:58.000+00:00,2018-09-27T08:32:25.000+00:00,2019-04-21T08:19:58.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,18, -1,381941219,134018330,17,closed," chinese ",""" chinese package chinese , chinese Release chinese :\r\n\r\n`\r\n\t// Release Closed this pool.\r\n\tfunc (p *PoolWithFunc) Release() error {\r\n\t\tp.once.Do(func() {\r\n\t\t\tp.release <- sig{}\r\n\t\t\tp.lock.Lock()\r\n\t\t\tidleWorkers := p.workers\r\n\t\t\tfor i, w := range idleWorkers {\r\n\t\t\t\tw.args <- nil\r\n\t\t\t\tidleWorkers[i] = nil\r\n\t\t\t}\r\n\t\t\tp.workers = nil\r\n\t\t\tp.lock.Unlock()\r\n\t\t})\r\n\t\treturn nil\r\n\t}\r\n`\r\n\r\nrelease chinese , chinese worker chinese ?\r\n chinese worker\r\n\r\n chinese ,release chinese worker chinese \r\n\r\n chinese :\r\n\r\nReSize(0) \r\n\r\n chinese ?\r\n""",,enhancement,7931755,zplzpl,0,,7856149,103594,https://github.com/panjf2000/ants/issues/17,2019-01-29T07:24:37.000+00:00,2018-11-18T08:50:31.000+00:00,2019-01-29T07:24:37.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,23, -1,382039050,134018330,18,closed,go chinese ,""" chinese , chinese , chinese go chinese , chinese , chinese 。\"" chinese : GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously。 chinese cpu chinese , chinese , chinese ?, chinese ?, chinese ?, chinese ?\""""",,question,13944100,LinuxForYQH,0,,7856149,20213,https://github.com/panjf2000/ants/issues/18,2018-12-03T03:53:50.000+00:00,2018-11-19T02:59:53.000+00:00,2018-12-03T03:53:50.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,24, -1,382574800,134018330,20,closed," chinese ","""#""",,enhancement,5668717,kklinan,0,,7856149,95398,https://github.com/panjf2000/ants/issues/20,2019-01-25T15:34:03.000+00:00,2018-11-20T09:36:02.000+00:00,2019-01-25T15:34:03.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,26, +1,381941219,134018330,17,closed," chinese ",""" chinese package chinese , chinese Release chinese :\r\n\r\n`\r\n\t// Release Closed this pool.\r\n\tfunc (p *PoolWithFunc) Release() error {\r\n\t\tp.once.Do(func() {\r\n\t\t\tp.release <- sig{}\r\n\t\t\tp.lock.Lock()\r\n\t\t\tidleWorkers := p.workers\r\n\t\t\tfor i, w := range idleWorkers {\r\n\t\t\t\tw.args <- nil\r\n\t\t\t\tidleWorkers[i] = nil\r\n\t\t\t}\r\n\t\t\tp.workers = nil\r\n\t\t\tp.lock.Unlock()\r\n\t\t})\r\n\t\treturn nil\r\n\t}\r\n`\r\n\r\nrelease chinese , chinese worker chinese ?\r\n chinese worker\r\n\r\n chinese ,release chinese worker chinese \r\n\r\n chinese :\r\n\r\nReSize(0) \r\n\r\n chinese ?\r\n""",,,7931755,zplzpl,0,,7856149,103594,https://github.com/panjf2000/ants/issues/17,2019-01-29T07:24:37.000+00:00,2018-11-18T08:50:31.000+00:00,2019-01-29T07:24:37.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,23, +1,382039050,134018330,18,closed,go chinese ,""" chinese , chinese , chinese go chinese , chinese , chinese 。\"" chinese : GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously。 chinese cpu chinese , chinese , chinese ?, chinese ?, chinese ?, chinese ?\""""",,,13944100,LinuxForYQH,0,,7856149,20213,https://github.com/panjf2000/ants/issues/18,2018-12-03T03:53:50.000+00:00,2018-11-19T02:59:53.000+00:00,2018-12-03T03:53:50.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,24, +1,382574800,134018330,20,closed," chinese ","""#""",,,5668717,kklinan,0,,7856149,95398,https://github.com/panjf2000/ants/issues/20,2019-01-25T15:34:03.000+00:00,2018-11-20T09:36:02.000+00:00,2019-01-25T15:34:03.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,26, 1,388907811,134018330,21,closed,Benchmark chinese Semaphore chinese ?,""" chinese benchmark,Semaphore chinese \r\n\r\n```bash\r\n$ go test -bench .\r\ngoos: darwin\r\ngoarch: amd64\r\npkg: github.com/panjf2000/ants\r\nBenchmarkGoroutineWithFunc-4 \t 1\t3445631705 ns/op\r\nBenchmarkSemaphoreWithFunc-4 \t 1\t1037219073 ns/op\r\nBenchmarkAntsPoolWithFunc-4 \t 1\t1138053222 ns/op\r\nBenchmarkGoroutine-4 \t 2\t 731850771 ns/op\r\nBenchmarkSemaphore-4 \t 2\t 914855967 ns/op\r\nBenchmarkAntsPool-4 \t 1\t1094379445 ns/op\r\nPASS\r\nok \tgithub.com/panjf2000/ants\t33.173s\r\n```\r\n chinese Ants chinese ?""",,,720086,huangjunwen,0,,7856149,8392,https://github.com/panjf2000/ants/issues/21,2018-12-14T06:01:07.000+00:00,2018-12-08T10:08:17.000+00:00,2018-12-14T06:01:07.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,27, -1,401277739,134018330,22,closed," chinese worker chinese PanicHandler ?",""" chinese Pool chinese PanicHandler, chinese worker chinese recover chinese PanicHandler chinese 。 chinese panic chinese 。""",,enhancement,8923413,choleraehyq,0,,7856149,1174,https://github.com/panjf2000/ants/issues/22,2019-01-22T05:41:34.000+00:00,2019-01-21T10:06:56.000+00:00,2019-01-22T05:41:34.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,28, -1,402513849,134018330,24,closed," chinese ","""`Pool.Submit` chinese `PoolWithFunc.Server` chinese , chinese worker, chinese 。 chinese , chinese 。""",,enhancement,5044825,tenfyzhong,0,,7856149,300032,https://github.com/panjf2000/ants/issues/24,2019-08-20T10:56:30.000+00:00,2019-01-24T02:24:13.000+00:00,2019-08-20T10:56:30.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,30, +1,401277739,134018330,22,closed," chinese worker chinese PanicHandler ?",""" chinese Pool chinese PanicHandler, chinese worker chinese recover chinese PanicHandler chinese 。 chinese panic chinese 。""",,,8923413,choleraehyq,0,,7856149,1174,https://github.com/panjf2000/ants/issues/22,2019-01-22T05:41:34.000+00:00,2019-01-21T10:06:56.000+00:00,2019-01-22T05:41:34.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,28, +1,402513849,134018330,24,closed," chinese ","""`Pool.Submit` chinese `PoolWithFunc.Server` chinese , chinese worker, chinese 。 chinese , chinese 。""",,,5044825,tenfyzhong,0,,7856149,300032,https://github.com/panjf2000/ants/issues/24,2019-08-20T10:56:30.000+00:00,2019-01-24T02:24:13.000+00:00,2019-08-20T10:56:30.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,30, 1,405951301,134018330,25,closed,use example errors,"""./antstest.go:37:14: cannot use syncCalculateSum (type func()) as type ants.f in argument to ants.Submit\r\n./antstest.go:45:35: cannot use func literal (type func(interface {})) as type ants.pf in argument to ants.NewPoolWithFunc\r\n""",,,5244267,jiashiwen,0,,7856149,3088,https://github.com/panjf2000/ants/issues/25,2019-02-04T09:11:52.000+00:00,2019-02-02T05:43:38.000+00:00,2019-02-04T09:11:52.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,31, 1,413968505,134018330,26,closed,running chinese cap chinese ,"""running chinese cap chinese incRuning chinese , chinese running chinese cap chinese ?\r\n`func (p *Pool) retrieveWorker() *Worker {\r\n\tvar w *Worker\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n >= 0 {\r\n\t\tw = idleWorkers[n]\r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t\tp.lock.Unlock()\r\n\t} else if p.Running() < p.Cap() {\r\n\t\tp.lock.Unlock()\r\n\t\tif cacheWorker := p.workerCache.Get(); cacheWorker != nil {\r\n\t\t\tw = cacheWorker.(*Worker)\r\n\t\t} else {\r\n\t\t\tw = &Worker{\r\n\t\t\t\tpool: p,\r\n\t\t\t\ttask: make(chan func(), workerChanCap),\r\n\t\t\t}\r\n\t\t}\r\n\t\tw.run()`""",,,10361713,Ainiroad,0,,7856149,21872,https://github.com/panjf2000/ants/issues/26,2019-03-12T12:01:57.000+00:00,2019-02-25T07:29:33.000+00:00,2019-03-12T12:01:57.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,32, 1,419183961,134018330,27,closed," chinese goroutine chinese , chinese ",""" chinese goroutine chinese , chinese \r\n chinese ?\r\n\r\nwebsocket server\r\nhttps://github.com/im-ai/pushm/blob/master/learn/goroutine/goroutinepoolwebsocket.go\r\n\r\nwebsocket cient\r\nhttps://github.com/im-ai/pushm/blob/master/learn/goroutine/goroutinepoolwebsocketclient.go\r\n""",,,38367404,liliang8858,0,,7856149,37496,https://github.com/panjf2000/ants/issues/27,2019-04-05T14:05:20.000+00:00,2019-03-10T13:08:52.000+00:00,2019-04-05T14:05:20.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,33, 1,419268851,134018330,28,closed,cap chinese running chinese ,""" chinese Playground chinese https://play.golang.org/p/D94YUU3FnX6\r\natomic chinese , chinese , chinese chinese , chinese chinese , chinese chinese , chinese \r\n chinese #26 chinese """,,,29243953,naiba,0,,7856149,237002,https://github.com/panjf2000/ants/issues/28,2019-08-22T16:27:37.000+00:00,2019-03-11T02:24:41.000+00:00,2019-08-22T16:27:37.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,34, 1,424634533,134018330,29,closed," chinese ",""" chinese , chinese 👍\r\n\r\nhttps://github.com/panjf2000/ants/blob/master/pool.go#L124 chinese , chinese ?\r\n""",,,8509898,prprprus,0,,7856149,999,https://github.com/panjf2000/ants/issues/29,2019-03-25T09:32:11.000+00:00,2019-03-24T16:52:21.000+00:00,2019-03-25T09:45:05.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,35, 1,429972115,134018330,31,closed,Add go.mod,"""""",,,48135919,tsatke,0,,7856149,3474,https://github.com/panjf2000/ants/issues/31,2019-04-08T09:45:31.000+00:00,2019-04-05T23:50:36.000+00:00,2019-10-17T03:12:19.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,37, -1,433564955,134018330,32,closed," chinese , chinese (0.0.x) chinese ?",""" chinese , chinese 。\r\n\r\n chinese \r\n\r\n chinese , chinese 。""",,enhancement,7931755,zplzpl,0,,7856149,7440,https://github.com/panjf2000/ants/issues/32,2019-04-21T07:16:26.000+00:00,2019-04-16T03:16:02.000+00:00,2019-04-21T07:16:26.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,38, -1,434069015,134018330,33,closed,support semantic versioning.,""" chinese tag chinese semantic versioning,vX.Y.Z。go modules chinese 。\r\nhttps://semver.org/\r\nhttps://research.swtch.com/vgo-import""",,enhancement,1284892,jjeffcaii,0,,7856149,6090,https://github.com/panjf2000/ants/issues/33,2019-04-21T08:25:20.000+00:00,2019-04-17T02:55:11.000+00:00,2019-04-21T08:25:20.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,39, +1,433564955,134018330,32,closed," chinese , chinese (0.0.x) chinese ?",""" chinese , chinese 。\r\n\r\n chinese \r\n\r\n chinese , chinese 。""",,,7931755,zplzpl,0,,7856149,7440,https://github.com/panjf2000/ants/issues/32,2019-04-21T07:16:26.000+00:00,2019-04-16T03:16:02.000+00:00,2019-04-21T07:16:26.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,38, +1,434069015,134018330,33,closed,support semantic versioning.,""" chinese tag chinese semantic versioning,vX.Y.Z。go modules chinese 。\r\nhttps://semver.org/\r\nhttps://research.swtch.com/vgo-import""",,,1284892,jjeffcaii,0,,7856149,6090,https://github.com/panjf2000/ants/issues/33,2019-04-21T08:25:20.000+00:00,2019-04-17T02:55:11.000+00:00,2019-04-21T08:25:20.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,39, 1,435486645,134018330,34,closed,Important announcement about from author !!!,"""**Dear users of `ants`:**\r\nI am apologetically telling you that I have to dump all tags which already presents in `ants` repository.\r\n\r\nThe reason why I'm doing so is to standardize the version management with `Semantic Versioning`, which will make a formal and clear dependency management in go, for go modules, godep, or glide, etc. So I decide to start over the tag sequence, you could find more details in [Semantic Versioning](https://semver.org/) and [Semantic Import Versioning](https://research.swtch.com/vgo-import), related issue: #32, #33 (very thankful to @jjeffcaii and @zplzpl who provided the suggestions about it).\r\n\r\nI ought to apologize for the bothers brought by this change, the arch-criminal who leads to this issue would be my lack of concept about `Semantic Versioning`, I will spend more times learning the knowledge afterwards. \r\n\r\nOnce again, sorry for your costs in this change and thanks for your support to `ants`! \r\n\r\n*Have fun!*\r\n\r\n**Best regards,\r\nAndy Pan**\r\n""",,,7496278,panjf2000,0,,7856149,23484,https://github.com/panjf2000/ants/issues/34,2019-05-07T15:35:08.000+00:00,2019-04-21T08:10:28.000+00:00,2019-05-07T15:35:08.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,40, 1,461280653,134018330,35,closed,worker exit on panic,""" chinese PanicHandler chinese 。\r\n1. chinese PanicHandler chinese , chinese panic, chinese 。\r\n2. chinese PanicHandler, chinese worker chinese , chinese pool chinese 。""",,,38849208,king526,0,,7856149,74481,https://github.com/panjf2000/ants/issues/35,2019-08-17T20:33:10.000+00:00,2019-06-27T03:11:49.000+00:00,2019-08-17T20:33:10.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,41, 1,462631417,134018330,37,closed," chinese 。。。",""" chinese 3.9.9, chinese , chinese , chinese 1.0.0。 chinese 。 chinese """,,,8923413,choleraehyq,0,,7856149,140,https://github.com/panjf2000/ants/issues/37,2019-07-01T12:37:55.000+00:00,2019-07-01T10:17:15.000+00:00,2019-07-02T10:17:31.000+00:00,,,"{""ConnectionId"":1,""Name"":""panjf2000/ants""}",_raw_github_api_issues,43, diff --git a/backend/plugins/github/tasks/issue_extractor.go b/backend/plugins/github/tasks/issue_extractor.go index 0801302fba1..974ad397d0e 100644 --- a/backend/plugins/github/tasks/issue_extractor.go +++ b/backend/plugins/github/tasks/issue_extractor.go @@ -210,32 +210,25 @@ func convertGithubLabels(issueRegexes *IssueRegexes, issue *IssuesResponse, gith IssueId: githubIssue.GithubId, LabelName: label.Name, }) - joinedLabels = append(joinedLabels, label.Name) - if issueRegexes.SeverityRegex != nil { - groups := issueRegexes.SeverityRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubIssue.Severity = groups[0] - } + if issueRegexes.SeverityRegex != nil && issueRegexes.SeverityRegex.MatchString(label.Name) { + githubIssue.Severity = label.Name } - if issueRegexes.ComponentRegex != nil { - groups := issueRegexes.ComponentRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubIssue.Component = groups[0] - } + if issueRegexes.ComponentRegex != nil && issueRegexes.ComponentRegex.MatchString(label.Name) { + githubIssue.Component = label.Name } - if issueRegexes.PriorityRegex != nil { - groups := issueRegexes.PriorityRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubIssue.Priority = groups[0] - } + if issueRegexes.PriorityRegex != nil && issueRegexes.PriorityRegex.MatchString(label.Name) { + githubIssue.Priority = label.Name } if issueRegexes.TypeRequirementRegex != nil && issueRegexes.TypeRequirementRegex.MatchString(label.Name) { githubIssue.StdType = ticket.REQUIREMENT + joinedLabels = append(joinedLabels, label.Name) } else if issueRegexes.TypeBugRegex != nil && issueRegexes.TypeBugRegex.MatchString(label.Name) { githubIssue.StdType = ticket.BUG + joinedLabels = append(joinedLabels, label.Name) } else if issueRegexes.TypeIncidentRegex != nil && issueRegexes.TypeIncidentRegex.MatchString(label.Name) { githubIssue.StdType = ticket.INCIDENT + joinedLabels = append(joinedLabels, label.Name) } } if len(joinedLabels) > 0 { diff --git a/backend/plugins/github/tasks/pr_extractor.go b/backend/plugins/github/tasks/pr_extractor.go index e2226582118..17fec4a45ba 100644 --- a/backend/plugins/github/tasks/pr_extractor.go +++ b/backend/plugins/github/tasks/pr_extractor.go @@ -143,19 +143,12 @@ func ExtractApiPullRequests(taskCtx plugin.SubTaskContext) errors.Error { LabelName: label.Name, }) // if pr.Type has not been set and prType is set in .env, process the below - if labelTypeRegex != nil { - groups := labelTypeRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubPr.Type = groups[0] - } + if labelTypeRegex != nil && labelTypeRegex.MatchString(label.Name) { + githubPr.Type = label.Name } - // if pr.Component has not been set and prComponent is set in .env, process - if labelComponentRegex != nil { - groups := labelComponentRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubPr.Component = groups[0] - } + if labelComponentRegex != nil && labelComponentRegex.MatchString(label.Name) { + githubPr.Component = label.Name } } results = append(results, githubPr) diff --git a/backend/plugins/github_graphql/tasks/issue_extractor.go b/backend/plugins/github_graphql/tasks/issue_extractor.go index deb54974ba7..355343e0c7d 100644 --- a/backend/plugins/github_graphql/tasks/issue_extractor.go +++ b/backend/plugins/github_graphql/tasks/issue_extractor.go @@ -171,32 +171,25 @@ func convertGithubLabels(issueRegexes *githubTasks.IssueRegexes, issue GraphqlQu IssueId: githubIssue.GithubId, LabelName: label.Name, }) - joinedLabels = append(joinedLabels, label.Name) - if issueRegexes.SeverityRegex != nil { - groups := issueRegexes.SeverityRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubIssue.Severity = groups[0] - } + if issueRegexes.SeverityRegex != nil && issueRegexes.SeverityRegex.MatchString(label.Name) { + githubIssue.Severity = label.Name } - if issueRegexes.ComponentRegex != nil { - groups := issueRegexes.ComponentRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubIssue.Component = groups[0] - } + if issueRegexes.ComponentRegex != nil && issueRegexes.ComponentRegex.MatchString(label.Name) { + githubIssue.Component = label.Name } - if issueRegexes.PriorityRegex != nil { - groups := issueRegexes.PriorityRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubIssue.Priority = groups[0] - } + if issueRegexes.PriorityRegex != nil && issueRegexes.PriorityRegex.MatchString(label.Name) { + githubIssue.Priority = label.Name } if issueRegexes.TypeRequirementRegex != nil && issueRegexes.TypeRequirementRegex.MatchString(label.Name) { githubIssue.StdType = ticket.REQUIREMENT + joinedLabels = append(joinedLabels, label.Name) } else if issueRegexes.TypeBugRegex != nil && issueRegexes.TypeBugRegex.MatchString(label.Name) { githubIssue.StdType = ticket.BUG + joinedLabels = append(joinedLabels, label.Name) } else if issueRegexes.TypeIncidentRegex != nil && issueRegexes.TypeIncidentRegex.MatchString(label.Name) { githubIssue.StdType = ticket.INCIDENT + joinedLabels = append(joinedLabels, label.Name) } } if len(joinedLabels) > 0 { diff --git a/backend/plugins/github_graphql/tasks/pr_extractor.go b/backend/plugins/github_graphql/tasks/pr_extractor.go index 11bace53f4c..9abcc4a06d3 100644 --- a/backend/plugins/github_graphql/tasks/pr_extractor.go +++ b/backend/plugins/github_graphql/tasks/pr_extractor.go @@ -19,6 +19,7 @@ package tasks import ( "encoding/json" + "fmt" "regexp" "github.com/apache/incubator-devlake/core/errors" @@ -52,6 +53,7 @@ func ExtractPrs(taskCtx plugin.SubTaskContext) errors.Error { } } if config != nil && len(config.PrComponent) > 0 { + fmt.Println("config.PrComponent1", config.PrComponent) labelComponentRegex, err = errors.Convert01(regexp.Compile(config.PrComponent)) if err != nil { return errors.Default.Wrap(err, "regexp Compile prComponent failed") @@ -88,19 +90,13 @@ func ExtractPrs(taskCtx plugin.SubTaskContext) errors.Error { LabelName: label.Name, }) // if pr.Type has not been set and prType is set in .env, process the below - if labelTypeRegex != nil { - groups := labelTypeRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubPr.Type = groups[0] - } + if labelTypeRegex != nil && labelTypeRegex.MatchString(label.Name) { + githubPr.Type = label.Name } - // if pr.Component has not been set and prComponent is set in .env, process - if labelComponentRegex != nil { - groups := labelComponentRegex.FindStringSubmatch(label.Name) - if len(groups) > 0 { - githubPr.Component = groups[0] - } + if labelComponentRegex != nil && labelComponentRegex.MatchString(label.Name) { + githubPr.Component = label.Name + } } results = append(results, githubPr) diff --git a/backend/plugins/gitlab/tasks/issue_extractor.go b/backend/plugins/gitlab/tasks/issue_extractor.go index 2ae75e7733f..116dc9acad2 100644 --- a/backend/plugins/gitlab/tasks/issue_extractor.go +++ b/backend/plugins/gitlab/tasks/issue_extractor.go @@ -20,6 +20,7 @@ package tasks import ( "encoding/json" "regexp" + "strings" "github.com/apache/incubator-devlake/core/errors" "github.com/apache/incubator-devlake/core/models/common" @@ -202,55 +203,38 @@ func ExtractApiIssues(taskCtx plugin.SubTaskContext) errors.Error { if err != nil { return nil, err } - + var joinedLabels []string for _, label := range body.Labels { results = append(results, &models.GitlabIssueLabel{ IssueId: gitlabIssue.GitlabId, LabelName: label, ConnectionId: data.Options.ConnectionId, }) - if issueSeverityRegex != nil { - groups := issueSeverityRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabIssue.Severity = groups[0] - } + if issueSeverityRegex != nil && issueSeverityRegex.MatchString(label) { + gitlabIssue.Severity = label } - - if issueComponentRegex != nil { - groups := issueComponentRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabIssue.Component = groups[0] - } + if issueComponentRegex != nil && issueComponentRegex.MatchString(label) { + gitlabIssue.Component = label } - - if issuePriorityRegex != nil { - groups := issuePriorityRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabIssue.Priority = groups[0] - } - } - - if issueTypeBugRegex != nil { - if ok := issueTypeBugRegex.MatchString(label); ok { - gitlabIssue.StdType = ticket.BUG - gitlabIssue.Type = label - } + if issuePriorityRegex != nil && issuePriorityRegex.MatchString(label) { + gitlabIssue.Priority = label } - if issueTypeRequirementRegex != nil { - if ok := issueTypeRequirementRegex.MatchString(label); ok { - gitlabIssue.StdType = ticket.REQUIREMENT - gitlabIssue.Type = label - } - } - - if issueTypeIncidentRegex != nil { - if ok := issueTypeIncidentRegex.MatchString(label); ok { - gitlabIssue.StdType = ticket.INCIDENT - gitlabIssue.Type = label - } + if issueTypeRequirementRegex != nil && issueTypeRequirementRegex.MatchString(label) { + gitlabIssue.StdType = ticket.REQUIREMENT + joinedLabels = append(joinedLabels, label) + } else if issueTypeBugRegex != nil && issueTypeBugRegex.MatchString(label) { + gitlabIssue.StdType = ticket.BUG + joinedLabels = append(joinedLabels, label) + } else if issueTypeIncidentRegex != nil && issueTypeIncidentRegex.MatchString(label) { + gitlabIssue.StdType = ticket.INCIDENT + joinedLabels = append(joinedLabels, label) } } + if len(joinedLabels) > 0 { + gitlabIssue.Type = strings.Join(joinedLabels, ",") + } + gitlabIssue.ConnectionId = data.Options.ConnectionId if body.Author != nil { gitlabAuthor, err := convertGitlabAuthor(body, data.Options.ConnectionId) diff --git a/backend/plugins/gitlab/tasks/mr_detail_extractor.go b/backend/plugins/gitlab/tasks/mr_detail_extractor.go index b4666f7eaff..9453a59fcea 100644 --- a/backend/plugins/gitlab/tasks/mr_detail_extractor.go +++ b/backend/plugins/gitlab/tasks/mr_detail_extractor.go @@ -84,19 +84,12 @@ func ExtractApiMergeRequestDetails(taskCtx plugin.SubTaskContext) errors.Error { ConnectionId: data.Options.ConnectionId, }) // if pr.Type has not been set and prType is set in .env, process the below - if labelTypeRegex != nil { - groups := labelTypeRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabMergeRequest.Type = groups[0] - } + if labelTypeRegex != nil && labelTypeRegex.MatchString(label) { + gitlabMergeRequest.Type = label } - // if pr.Component has not been set and prComponent is set in .env, process - if labelComponentRegex != nil { - groups := labelComponentRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabMergeRequest.Component = groups[0] - } + if labelComponentRegex != nil && labelComponentRegex.MatchString(label) { + gitlabMergeRequest.Component = label } } for _, reviewer := range mr.Reviewers { diff --git a/backend/plugins/gitlab/tasks/mr_extractor.go b/backend/plugins/gitlab/tasks/mr_extractor.go index 2f59a03adc7..92bfccfa3f5 100644 --- a/backend/plugins/gitlab/tasks/mr_extractor.go +++ b/backend/plugins/gitlab/tasks/mr_extractor.go @@ -141,19 +141,12 @@ func ExtractApiMergeRequests(taskCtx plugin.SubTaskContext) errors.Error { ConnectionId: data.Options.ConnectionId, }) // if pr.Type has not been set and prType is set in .env, process the below - if labelTypeRegex != nil { - groups := labelTypeRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabMergeRequest.Type = groups[0] - } + if labelTypeRegex != nil && labelTypeRegex.MatchString(label) { + gitlabMergeRequest.Type = label } - // if pr.Component has not been set and prComponent is set in .env, process - if labelComponentRegex != nil { - groups := labelComponentRegex.FindStringSubmatch(label) - if len(groups) > 0 { - gitlabMergeRequest.Component = groups[0] - } + if labelComponentRegex != nil && labelComponentRegex.MatchString(label) { + gitlabMergeRequest.Component = label } } for _, reviewer := range mr.Reviewers {