This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new f53d9ca4d refactor: unify plugin type to struct{} (#6272)
f53d9ca4d is described below

commit f53d9ca4df899eee17ff007fc42493f0ada17f92
Author: Klesh Wong <[email protected]>
AuthorDate: Wed Oct 18 14:06:41 2023 +0800

    refactor: unify plugin type to struct{} (#6272)
---
 backend/plugins/bitbucket/impl/impl.go           |  2 +-
 backend/plugins/gitee/impl/impl.go               |  2 +-
 backend/plugins/gitlab/impl/impl.go              |  2 +-
 backend/plugins/starrocks/impl/impl.go           |  2 +-
 backend/plugins/table_info_test.go               |  8 ++++----
 backend/test/e2e/manual/gitlab/gitlab_test.go    |  2 +-
 backend/test/e2e/services/server_startup_test.go | 11 ++++++-----
 7 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/backend/plugins/bitbucket/impl/impl.go 
b/backend/plugins/bitbucket/impl/impl.go
index 57c243418..8611b1287 100644
--- a/backend/plugins/bitbucket/impl/impl.go
+++ b/backend/plugins/bitbucket/impl/impl.go
@@ -45,7 +45,7 @@ var _ interface {
        plugin.PluginSource
 } = (*Bitbucket)(nil)
 
-type Bitbucket string
+type Bitbucket struct{}
 
 func (p Bitbucket) Connection() dal.Tabler {
        return &models.BitbucketConnection{}
diff --git a/backend/plugins/gitee/impl/impl.go 
b/backend/plugins/gitee/impl/impl.go
index 5a1510cf2..7ccf03a4f 100644
--- a/backend/plugins/gitee/impl/impl.go
+++ b/backend/plugins/gitee/impl/impl.go
@@ -44,7 +44,7 @@ var _ interface {
 
 var _ plugin.PluginSource = (*Gitee)(nil)
 
-type Gitee string
+type Gitee struct{}
 
 func (p Gitee) Connection() dal.Tabler {
        return &models.GiteeConnection{}
diff --git a/backend/plugins/gitlab/impl/impl.go 
b/backend/plugins/gitlab/impl/impl.go
index d4799ab3e..94e615e2f 100644
--- a/backend/plugins/gitlab/impl/impl.go
+++ b/backend/plugins/gitlab/impl/impl.go
@@ -46,7 +46,7 @@ var _ interface {
        plugin.CloseablePluginTask
 } = (*Gitlab)(nil)
 
-type Gitlab string
+type Gitlab struct{}
 
 func init() {
        // check subtask meta loop when init subtask meta
diff --git a/backend/plugins/starrocks/impl/impl.go 
b/backend/plugins/starrocks/impl/impl.go
index a608d2b46..511b8c7ec 100644
--- a/backend/plugins/starrocks/impl/impl.go
+++ b/backend/plugins/starrocks/impl/impl.go
@@ -25,7 +25,7 @@ import (
        "github.com/apache/incubator-devlake/plugins/starrocks/tasks"
 )
 
-type StarRocks string
+type StarRocks struct{}
 
 // make sure interface is implemented
 var _ interface {
diff --git a/backend/plugins/table_info_test.go 
b/backend/plugins/table_info_test.go
index 251d4f500..698b215f8 100644
--- a/backend/plugins/table_info_test.go
+++ b/backend/plugins/table_info_test.go
@@ -57,16 +57,16 @@ func Test_GetPluginTablesInfo(t *testing.T) {
        })
        checker.FeedIn("ae/models", ae.AE{}.GetTablesInfo)
        checker.FeedIn("bamboo/models", bamboo.Bamboo{}.GetTablesInfo)
-       checker.FeedIn("bitbucket/models", 
bitbucket.Bitbucket("").GetTablesInfo)
+       checker.FeedIn("bitbucket/models", bitbucket.Bitbucket{}.GetTablesInfo)
        checker.FeedIn("customize/models", customize.Customize{}.GetTablesInfo)
        checker.FeedIn("dbt", dbt.Dbt{}.GetTablesInfo)
        checker.FeedIn("dora/models", dora.Dora{}.GetTablesInfo)
        checker.FeedIn("feishu/models", feishu.Feishu{}.GetTablesInfo)
-       checker.FeedIn("gitee/models", gitee.Gitee("").GetTablesInfo)
+       checker.FeedIn("gitee/models", gitee.Gitee{}.GetTablesInfo)
        checker.FeedIn("gitextractor/models", 
gitextractor.GitExtractor{}.GetTablesInfo)
        checker.FeedIn("github/models", github.Github{}.GetTablesInfo)
        checker.FeedIn("github_graphql", 
githubGraphql.GithubGraphql{}.GetTablesInfo)
-       checker.FeedIn("gitlab/models", gitlab.Gitlab("").GetTablesInfo)
+       checker.FeedIn("gitlab/models", gitlab.Gitlab{}.GetTablesInfo)
        checker.FeedIn("icla/models", icla.Icla{}.GetTablesInfo)
        checker.FeedIn("jenkins/models", jenkins.Jenkins{}.GetTablesInfo)
        checker.FeedIn("jira/models", jira.Jira{}.GetTablesInfo)
@@ -75,7 +75,7 @@ func Test_GetPluginTablesInfo(t *testing.T) {
        checker.FeedIn("refdiff/models", refdiff.RefDiff{}.GetTablesInfo)
        checker.FeedIn("slack/models", slack.Slack{}.GetTablesInfo)
        checker.FeedIn("sonarqube/models", sonarqube.Sonarqube{}.GetTablesInfo)
-       checker.FeedIn("starrocks", starrocks.StarRocks("").GetTablesInfo)
+       checker.FeedIn("starrocks", starrocks.StarRocks{}.GetTablesInfo)
        checker.FeedIn("tapd/models", tapd.Tapd{}.GetTablesInfo)
        checker.FeedIn("teambition/models", 
teambition.Teambition{}.GetTablesInfo)
        checker.FeedIn("trello/models", trello.Trello{}.GetTablesInfo)
diff --git a/backend/test/e2e/manual/gitlab/gitlab_test.go 
b/backend/test/e2e/manual/gitlab/gitlab_test.go
index eca43ba84..af6247aa5 100644
--- a/backend/test/e2e/manual/gitlab/gitlab_test.go
+++ b/backend/test/e2e/manual/gitlab/gitlab_test.go
@@ -61,7 +61,7 @@ func TestGitlabPlugin(t *testing.T) {
                DropDb:       false,
                TruncateDb:   true,
                Plugins: []plugin.PluginMeta{
-                       gitlab.Gitlab(""),
+                       gitlab.Gitlab{},
                        gitextractor.GitExtractor{},
                },
        })
diff --git a/backend/test/e2e/services/server_startup_test.go 
b/backend/test/e2e/services/server_startup_test.go
index 1ca0ab215..db6db1d26 100644
--- a/backend/test/e2e/services/server_startup_test.go
+++ b/backend/test/e2e/services/server_startup_test.go
@@ -18,6 +18,8 @@ limitations under the License.
 package services
 
 import (
+       "testing"
+
        "github.com/apache/incubator-devlake/core/plugin"
        ae "github.com/apache/incubator-devlake/plugins/ae/impl"
        bamboo "github.com/apache/incubator-devlake/plugins/bamboo/impl"
@@ -47,7 +49,6 @@ import (
        zentao "github.com/apache/incubator-devlake/plugins/zentao/impl"
        "github.com/apache/incubator-devlake/test/helper"
        "github.com/stretchr/testify/require"
-       "testing"
 )
 
 func TestStartup(t *testing.T) {
@@ -60,16 +61,16 @@ func loadGoPlugins() []plugin.PluginMeta {
        return []plugin.PluginMeta{
                ae.AE{},
                bamboo.Bamboo{},
-               bitbucket.Bitbucket(""),
+               bitbucket.Bitbucket{},
                customize.Customize{},
                dbt.Dbt{},
                dora.Dora{},
                feishu.Feishu{},
-               gitee.Gitee(""),
+               gitee.Gitee{},
                gitextractor.GitExtractor{},
                github.Github{},
                githubGraphql.GithubGraphql{},
-               gitlab.Gitlab(""),
+               gitlab.Gitlab{},
                icla.Icla{},
                jenkins.Jenkins{},
                jira.Jira{},
@@ -78,7 +79,7 @@ func loadGoPlugins() []plugin.PluginMeta {
                refdiff.RefDiff{},
                slack.Slack{},
                sonarqube.Sonarqube{},
-               starrocks.StarRocks(""),
+               starrocks.StarRocks{},
                tapd.Tapd{},
                teambition.Teambition{},
                trello.Trello{},

Reply via email to