You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "abeizn (via GitHub)" <gi...@apache.org> on 2023/02/06 08:51:16 UTC

[GitHub] [incubator-devlake] abeizn opened a new pull request, #4332: feat: sonarqube issue collector and extractor

abeizn opened a new pull request, #4332:
URL: https://github.com/apache/incubator-devlake/pull/4332

   ### Summary
   sonarqube issue collector and extractor
   
   ### Does this close any open issues?
   part of 
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #4332: feat: sonarqube issue collector and extractor

Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4332:
URL: https://github.com/apache/incubator-devlake/pull/4332#discussion_r1097101425


##########
backend/plugins/sonarqube/models/sonarqube_issue.go:
##########
@@ -0,0 +1,73 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package models
+
+import (
+	"github.com/apache/incubator-devlake/core/models/common"
+	"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+)
+
+type SonarqubeIssue1 struct {
+	common.NoPKModel
+	ConnectionId             uint64           `gorm:"primaryKey"`
+	Key                      string           `json:"key" gorm:"primaryKey"`
+	BatchId                  string           `json:"batchId" gorm:"primaryKey"` // from collection time
+	Component                string           `json:"component"`
+	Project                  string           `json:"project" gorm:"index"` // projects.key
+	SecurityCategory         string           `json:"securityCategory"`
+	VulnerabilityProbability string           `json:"vulnerabilityProbability"`
+	Status                   string           `json:"status"`
+	Line                     int              `json:"line"`
+	Message                  string           `json:"message"`
+	Assignee                 string           `json:"assignee"`
+	Author                   string           `json:"author"`
+	CreationDate             *api.Iso8601Time `json:"creationDate"`
+	UpdateDate               *api.Iso8601Time `json:"updateDate"`
+	RuleKey                  string           `json:"ruleKey"`
+}

Review Comment:
   what is this?



##########
backend/plugins/sonarqube/tasks/issues_collector.go:
##########
@@ -0,0 +1,101 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package tasks
+
+import (
+	"encoding/json"
+	"fmt"
+	"net/http"
+	"net/url"
+	"reflect"
+
+	"github.com/apache/incubator-devlake/core/dal"
+	"github.com/apache/incubator-devlake/core/errors"
+	"github.com/apache/incubator-devlake/core/plugin"
+	helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+	"github.com/apache/incubator-devlake/plugins/sonarqube/models"
+)
+
+const RAW_ISSUES_TABLE = "sonarqube_issues"
+
+var _ plugin.SubTaskEntryPoint = CollectIssues
+
+func CollectIssues(taskCtx plugin.SubTaskContext) (err errors.Error) {
+	db := taskCtx.GetDal()
+	rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_ISSUES_TABLE)
+	logger := taskCtx.GetLogger()
+	logger.Info("collect issues")
+
+	project := &models.SonarqubeProject{}
+	cursor, err := db.Cursor(
+		dal.From(project),
+		dal.Where("connection_id=?", data.Options.ConnectionId),
+	)

Review Comment:
   I think maybe we should use data.Options.ProjectKey as data scope? @Startrekzky 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 merged pull request #4332: feat: sonarqube issue collector and extractor

Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 merged PR #4332:
URL: https://github.com/apache/incubator-devlake/pull/4332


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org