You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by zh...@apache.org on 2022/06/08 12:07:09 UTC

[incubator-devlake] 01/06: fix: golangci-lint not works in CI (#2084)

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

zhangliang2022 pushed a commit to branch release-v0.11
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit a17e2f50bae90bf8af458aed8d2db118e9fb54db
Author: Ji Bin <ma...@live.com>
AuthorDate: Mon Jun 6 21:50:03 2022 +0800

    fix: golangci-lint not works in CI (#2084)
    
    - run golangci-lint in lake-builder to ensure the toolchain is same as builder
    - fix some header missing errors
    - add //nolint and TODO for some errors(4 in total)
    - enable gofmt in golangci-lint and add `make fmt` for format the whole project
    
    fixes: #2077
    
    Signed-off-by: Ji Bin <ma...@live.com>
---
 .github/workflows/golangci-lint.yml                 |  4 +---
 .golangci.yaml                                      |  3 ++-
 Makefile                                            |  3 +++
 config/config_test.go                               | 17 +++++++++++++++++
 plugins/gitlab/models/issue.go                      | 17 +++++++++++++++++
 plugins/gitlab/models/issue_label.go                | 21 +++++++++++++++++++--
 .../migrationscripts/update_schemas20220525.go      | 10 +++++-----
 plugins/gitlab/tasks/issue_collector.go             | 19 ++++++++++++++++++-
 plugins/gitlab/tasks/issue_convertor.go             | 17 +++++++++++++++++
 plugins/gitlab/tasks/issue_extractor.go             | 18 ++++++++++++++++++
 plugins/gitlab/tasks/issue_label_convertor.go       | 17 +++++++++++++++++
 plugins/gitlab/tasks/shared.go                      |  2 +-
 plugins/helper/api_collector.go                     |  4 ++--
 plugins/helper/data_convertor_test.go               | 17 +++++++++++++++++
 plugins/helper/default_task_context.go              |  4 ++--
 .../models/migrationscripts/archived/changelog.go   |  8 ++++----
 .../migrationscripts/updateSchemas20220527.go       |  2 +-
 plugins/jira/models/response_type.go                |  5 ++---
 .../refdiff/tasks/refs_pr_cherry_pick_calculator.go |  2 +-
 plugins/tapd/models/bug_custom_field.go             | 17 +++++++++++++++++
 .../migrationscripts/archived/bug_custom_field.go   | 17 +++++++++++++++++
 .../migrationscripts/archived/story_category.go     | 17 +++++++++++++++++
 .../migrationscripts/archived/story_custom_field.go | 17 +++++++++++++++++
 .../migrationscripts/archived/task_custom_field.go  | 17 +++++++++++++++++
 .../migrationscripts/update_schemas20220531.go      |  2 +-
 plugins/tapd/models/story_category.go               | 17 +++++++++++++++++
 plugins/tapd/models/story_custom_field.go           | 17 +++++++++++++++++
 plugins/tapd/models/task_custom_field.go            | 17 +++++++++++++++++
 plugins/tapd/tapd.go                                |  5 +++--
 plugins/tapd/tasks/bug_changelog_converter.go       |  4 ++--
 30 files changed, 306 insertions(+), 31 deletions(-)

diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
index acf1580b..856344b7 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -10,10 +10,8 @@ jobs:
   golangci:
     name: lint
     runs-on: ubuntu-latest
+    container: mericodev/lake-builder:latest
     steps:
-      - uses: actions/setup-go@v3
-        with:
-          go-version: '1.17.x'
       - uses: actions/checkout@v3
       - name: Cache golangci-lint
         id: cache-golangci-lint
diff --git a/.golangci.yaml b/.golangci.yaml
index 4aa61338..6b9663b6 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -31,6 +31,7 @@ linters:
 #    - exhaustive
 #    - funlen
 #    - goconst
+    - gofmt
     - goheader
 #    - goimports
 #    - gomnd
@@ -62,4 +63,4 @@ run:
   issues-exit-code: 2
   # Include test files or not.
   # Default: true
-  tests: false
\ No newline at end of file
+  tests: false
diff --git a/Makefile b/Makefile
index 561c6170..65345316 100644
--- a/Makefile
+++ b/Makefile
@@ -68,6 +68,9 @@ real-e2e-test:
 lint:
 	golangci-lint run
 
+fmt:
+	find -name \*.go | xargs gofmt -w -l
+
 clean:
 	@rm -rf bin
 
diff --git a/config/config_test.go b/config/config_test.go
index 50a22c1a..6efe9183 100644
--- a/config/config_test.go
+++ b/config/config_test.go
@@ -1,3 +1,20 @@
+/*
+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 config
 
 import (
diff --git a/plugins/gitlab/models/issue.go b/plugins/gitlab/models/issue.go
index 3fed54e8..2432824d 100644
--- a/plugins/gitlab/models/issue.go
+++ b/plugins/gitlab/models/issue.go
@@ -1,3 +1,20 @@
+/*
+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 (
diff --git a/plugins/gitlab/models/issue_label.go b/plugins/gitlab/models/issue_label.go
index 41ad0852..17441766 100644
--- a/plugins/gitlab/models/issue_label.go
+++ b/plugins/gitlab/models/issue_label.go
@@ -1,7 +1,24 @@
+/*
+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/models/common"
+	"github.com/apache/incubator-devlake/models/common"
 )
 
 // Please note that Issue Labels can also apply to Pull Requests.
@@ -13,6 +30,6 @@ type GitlabIssueLabel struct {
 	common.NoPKModel
 }
 
-func (GitlabIssueLabel) TableName() string{
+func (GitlabIssueLabel) TableName() string {
 	return "_tool_gitlab_issue_labels"
 }
diff --git a/plugins/gitlab/models/migrationscripts/update_schemas20220525.go b/plugins/gitlab/models/migrationscripts/update_schemas20220525.go
index 694d1b93..5df572bd 100644
--- a/plugins/gitlab/models/migrationscripts/update_schemas20220525.go
+++ b/plugins/gitlab/models/migrationscripts/update_schemas20220525.go
@@ -45,27 +45,27 @@ type GitlabIssue20220525 struct {
 	GitlabUpdatedAt time.Time `gorm:"index"`
 	Severity        string    `gorm:"type:varchar(255)"`
 	Component       string    `gorm:"type:varchar(255)"`
-	TimeEstimate 	int64
-	TotalTimeSpent 	int64
+	TimeEstimate    int64
+	TotalTimeSpent  int64
 	archived.NoPKModel
 }
+
 func (GitlabIssue20220525) TableName() string {
 	return "_tool_gitlab_issues"
 }
 
-
 type GitlabIssueLabel20220525 struct {
 	IssueId   int    `gorm:"primaryKey;autoIncrement:false"`
 	LabelName string `gorm:"primaryKey;type:varchar(255)"`
 	archived.NoPKModel
 }
 
-func (GitlabIssueLabel20220525) TableName() string{
+func (GitlabIssueLabel20220525) TableName() string {
 	return "_tool_gitlab_issue_labels"
 }
 
 func (*UpdateSchemas20220525) Up(ctx context.Context, db *gorm.DB) error {
-	err := db.Migrator().AutoMigrate(GitlabIssue20220525{},GitlabIssueLabel20220525{})
+	err := db.Migrator().AutoMigrate(GitlabIssue20220525{}, GitlabIssueLabel20220525{})
 	if err != nil {
 		return err
 	}
diff --git a/plugins/gitlab/tasks/issue_collector.go b/plugins/gitlab/tasks/issue_collector.go
index f5f4d5a6..15342648 100644
--- a/plugins/gitlab/tasks/issue_collector.go
+++ b/plugins/gitlab/tasks/issue_collector.go
@@ -1,3 +1,20 @@
+/*
+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 (
@@ -56,7 +73,7 @@ func CollectApiIssues(taskCtx core.SubTaskContext) error {
 				set of data to be process, for example, we process JiraIssues by Board
 			*/
 			Params: GitlabApiParams{
-				ProjectId:  data.Options.ProjectId,
+				ProjectId: data.Options.ProjectId,
 			},
 			/*
 				Table store raw data
diff --git a/plugins/gitlab/tasks/issue_convertor.go b/plugins/gitlab/tasks/issue_convertor.go
index 3133dea9..2101d328 100644
--- a/plugins/gitlab/tasks/issue_convertor.go
+++ b/plugins/gitlab/tasks/issue_convertor.go
@@ -1,3 +1,20 @@
+/*
+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 (
diff --git a/plugins/gitlab/tasks/issue_extractor.go b/plugins/gitlab/tasks/issue_extractor.go
index d4870483..4be8ed80 100644
--- a/plugins/gitlab/tasks/issue_extractor.go
+++ b/plugins/gitlab/tasks/issue_extractor.go
@@ -1,7 +1,25 @@
+/*
+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"
+
 	"github.com/apache/incubator-devlake/plugins/core"
 
 	"github.com/apache/incubator-devlake/plugins/gitlab/models"
diff --git a/plugins/gitlab/tasks/issue_label_convertor.go b/plugins/gitlab/tasks/issue_label_convertor.go
index fdbad910..4556ac23 100644
--- a/plugins/gitlab/tasks/issue_label_convertor.go
+++ b/plugins/gitlab/tasks/issue_label_convertor.go
@@ -1,3 +1,20 @@
+/*
+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 (
diff --git a/plugins/gitlab/tasks/shared.go b/plugins/gitlab/tasks/shared.go
index ae40ade5..3c5ffb1a 100644
--- a/plugins/gitlab/tasks/shared.go
+++ b/plugins/gitlab/tasks/shared.go
@@ -97,7 +97,7 @@ func GetMergeRequestsIterator(taskCtx core.SubTaskContext) (*helper.CursorIterat
 	db := taskCtx.GetDb()
 	data := taskCtx.GetData().(*GitlabTaskData)
 	cursor, err := db.Model(&models.GitlabMergeRequest{}).Select("gitlab_id, iid").
-	Where("project_id = ?", data.Options.ProjectId).Select("gitlab_id,iid").Rows()
+		Where("project_id = ?", data.Options.ProjectId).Select("gitlab_id,iid").Rows()
 	if err != nil {
 		return nil, err
 	}
diff --git a/plugins/helper/api_collector.go b/plugins/helper/api_collector.go
index 447b5eb9..23cbb099 100644
--- a/plugins/helper/api_collector.go
+++ b/plugins/helper/api_collector.go
@@ -185,7 +185,7 @@ func (collector *ApiCollector) Execute() error {
 				go func() {
 					defer func() {
 						wg.Done()
-						recover()
+						recover() //nolint TODO: check the return and do log if not nil
 					}()
 					e := collector.exec(input)
 					// propagate error
@@ -416,7 +416,7 @@ func (collector *ApiCollector) handleResponseWithPages(reqData *RequestData) Api
 		go func() {
 			defer func() {
 				collector.args.ApiClient.Done()
-				recover()
+				recover() //nolint TODO: check the return and do log if not nil
 			}()
 			for page := 2; page <= totalPages; page++ {
 				reqDataTemp := &RequestData{
diff --git a/plugins/helper/data_convertor_test.go b/plugins/helper/data_convertor_test.go
index 01843d26..3a4d84f7 100644
--- a/plugins/helper/data_convertor_test.go
+++ b/plugins/helper/data_convertor_test.go
@@ -1,3 +1,20 @@
+/*
+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 helper
 
 import (
diff --git a/plugins/helper/default_task_context.go b/plugins/helper/default_task_context.go
index b667b82b..f49e2534 100644
--- a/plugins/helper/default_task_context.go
+++ b/plugins/helper/default_task_context.go
@@ -188,14 +188,14 @@ func (c *DefaultTaskContext) SubTaskContext(subtask string) (core.SubTaskContext
 	if run, ok := c.subtasks[subtask]; ok {
 		if run {
 			// now, create a sub task context if it didn't exist
-			c.mu.Lock()
+			c.defaultExecContext.mu.Lock()
 			if c.subtaskCtxs[subtask] == nil {
 				c.subtaskCtxs[subtask] = &DefaultSubTaskContext{
 					c.defaultExecContext.fork(subtask),
 					c,
 				}
 			}
-			c.mu.Unlock()
+			c.defaultExecContext.mu.Unlock()
 			return c.subtaskCtxs[subtask], nil
 		}
 		// subtasks is skipped
diff --git a/plugins/jira/models/migrationscripts/archived/changelog.go b/plugins/jira/models/migrationscripts/archived/changelog.go
index 11e05ab7..4b87297b 100644
--- a/plugins/jira/models/migrationscripts/archived/changelog.go
+++ b/plugins/jira/models/migrationscripts/archived/changelog.go
@@ -45,10 +45,10 @@ type JiraChangelogItem struct {
 	Field       string `gorm:"primaryKey"`
 	FieldType   string
 	FieldId     string
-	From         string
-	FromString   string
-	To           string
-	ToString     string
+	From        string
+	FromString  string
+	To          string
+	ToString    string
 }
 
 func (JiraChangelog) TableName() string {
diff --git a/plugins/jira/models/migrationscripts/updateSchemas20220527.go b/plugins/jira/models/migrationscripts/updateSchemas20220527.go
index 145498dc..ab9d2a27 100644
--- a/plugins/jira/models/migrationscripts/updateSchemas20220527.go
+++ b/plugins/jira/models/migrationscripts/updateSchemas20220527.go
@@ -47,7 +47,7 @@ func (JiraChangelogItem20220527) TableName() string {
 type UpdateSchemas20220527 struct{}
 
 func (*UpdateSchemas20220527) Up(ctx context.Context, db *gorm.DB) error {
-	
+
 	err := db.Migrator().RenameColumn(jiraArchived.JiraChangelogItem{}, "from", "from_value")
 	if err != nil {
 		return err
diff --git a/plugins/jira/models/response_type.go b/plugins/jira/models/response_type.go
index a1a714f5..0fcd4236 100644
--- a/plugins/jira/models/response_type.go
+++ b/plugins/jira/models/response_type.go
@@ -41,11 +41,10 @@ type ApiMyselfResponse struct {
 	DisplayName string
 }
 
-func (JiraServerInfo) TableName() string{
+func (JiraServerInfo) TableName() string {
 	return "_tool_jira_server_infos"
 }
 
-func (ApiMyselfResponse) TableName() string{
+func (ApiMyselfResponse) TableName() string {
 	return "_tool_api_myself_responses"
 }
-
diff --git a/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go b/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go
index 602063d8..e5f2b0b4 100644
--- a/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go
+++ b/plugins/refdiff/tasks/refs_pr_cherry_pick_calculator.go
@@ -44,7 +44,7 @@ func CalculatePrCherryPick(taskCtx core.SubTaskContext) error {
 	ctx := taskCtx.GetContext()
 	db := taskCtx.GetDb()
 	var prTitleRegex *regexp.Regexp
-	
+
 	prTitlePattern := taskCtx.GetConfig("GITHUB_PR_TITLE_PATTERN")
 	if len(prTitlePattern) > 0 {
 		prTitleRegex = regexp.MustCompile(prTitlePattern)
diff --git a/plugins/tapd/models/bug_custom_field.go b/plugins/tapd/models/bug_custom_field.go
index aca33127..b0005ef2 100644
--- a/plugins/tapd/models/bug_custom_field.go
+++ b/plugins/tapd/models/bug_custom_field.go
@@ -1,3 +1,20 @@
+/*
+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/models/common"
diff --git a/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go b/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
index 2dbb8677..1027721e 100644
--- a/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/bug_custom_field.go
@@ -1,3 +1,20 @@
+/*
+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 archived
 
 import "github.com/apache/incubator-devlake/models/common"
diff --git a/plugins/tapd/models/migrationscripts/archived/story_category.go b/plugins/tapd/models/migrationscripts/archived/story_category.go
index d85519e8..3e99c8ac 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_category.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_category.go
@@ -1,3 +1,20 @@
+/*
+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 archived
 
 import (
diff --git a/plugins/tapd/models/migrationscripts/archived/story_custom_field.go b/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
index 0c951804..79360672 100644
--- a/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/story_custom_field.go
@@ -1,3 +1,20 @@
+/*
+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 archived
 
 import "github.com/apache/incubator-devlake/models/common"
diff --git a/plugins/tapd/models/migrationscripts/archived/task_custom_field.go b/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
index dfd906db..afc20788 100644
--- a/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
+++ b/plugins/tapd/models/migrationscripts/archived/task_custom_field.go
@@ -1,3 +1,20 @@
+/*
+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 archived
 
 import "github.com/apache/incubator-devlake/models/common"
diff --git a/plugins/tapd/models/migrationscripts/update_schemas20220531.go b/plugins/tapd/models/migrationscripts/update_schemas20220531.go
index 917691a8..0eb4f3a3 100644
--- a/plugins/tapd/models/migrationscripts/update_schemas20220531.go
+++ b/plugins/tapd/models/migrationscripts/update_schemas20220531.go
@@ -110,4 +110,4 @@ func (*UpdateSchemas20220531) Name() string {
 
 func (*UpdateSchemas20220531) Owner() string {
 	return "tapd"
-}
\ No newline at end of file
+}
diff --git a/plugins/tapd/models/story_category.go b/plugins/tapd/models/story_category.go
index 3c9ba2a1..085818f6 100644
--- a/plugins/tapd/models/story_category.go
+++ b/plugins/tapd/models/story_category.go
@@ -1,3 +1,20 @@
+/*
+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 (
diff --git a/plugins/tapd/models/story_custom_field.go b/plugins/tapd/models/story_custom_field.go
index 4fd66834..2d54e588 100644
--- a/plugins/tapd/models/story_custom_field.go
+++ b/plugins/tapd/models/story_custom_field.go
@@ -1,3 +1,20 @@
+/*
+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/models/common"
diff --git a/plugins/tapd/models/task_custom_field.go b/plugins/tapd/models/task_custom_field.go
index b5008565..62b6f101 100644
--- a/plugins/tapd/models/task_custom_field.go
+++ b/plugins/tapd/models/task_custom_field.go
@@ -1,3 +1,20 @@
+/*
+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/models/common"
diff --git a/plugins/tapd/tapd.go b/plugins/tapd/tapd.go
index e20194be..07d4e370 100644
--- a/plugins/tapd/tapd.go
+++ b/plugins/tapd/tapd.go
@@ -19,9 +19,10 @@ package main
 
 import (
 	"fmt"
+	"time"
+
 	"github.com/apache/incubator-devlake/config"
 	"github.com/apache/incubator-devlake/logger"
-	"time"
 
 	"github.com/apache/incubator-devlake/migration"
 	"github.com/apache/incubator-devlake/models/domainlayer/didgen"
@@ -219,7 +220,7 @@ func main() {
 			panic(err)
 		}
 		wsList := make([]*models.TapdWorkspace, 0)
-		err = db.Find(&wsList, "parent_id = ?", 59169984).Error
+		err = db.Find(&wsList, "parent_id = ?", 59169984).Error //nolint TODO: fix the unused err
 		for _, v := range wsList {
 			*workspaceId = v.ID
 			runner.DirectRun(c, args, PluginEntry, map[string]interface{}{
diff --git a/plugins/tapd/tasks/bug_changelog_converter.go b/plugins/tapd/tasks/bug_changelog_converter.go
index 87cd5fd8..8f430262 100644
--- a/plugins/tapd/tasks/bug_changelog_converter.go
+++ b/plugins/tapd/tasks/bug_changelog_converter.go
@@ -87,8 +87,8 @@ func ConvertBugChangelog(taskCtx core.SubTaskContext) error {
 				AuthorName:  cl.Author,
 				FieldId:     cl.Field,
 				FieldName:   cl.Field,
-				FromValue:        cl.ValueBeforeParsed,
-				ToValue:          cl.ValueAfterParsed,
+				FromValue:   cl.ValueBeforeParsed,
+				ToValue:     cl.ValueAfterParsed,
 				CreatedDate: cl.Created,
 			}