Skip to content

Commit

Permalink
+ [fix#54340] fmt code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ysicing committed Aug 26, 2024
1 parent bdda1f0 commit f73661c
Show file tree
Hide file tree
Showing 200 changed files with 767 additions and 521 deletions.
7 changes: 7 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ env:

tasks:

fmt:
desc: format code
cmds:
- gci write --skip-generated --custom-order -s standard -s default -s "prefix(github.com/easysoft/zentaoatf)" -s blank -s dot -s alias .
- gofmt -s -w .
- goimports -w .

clean:
desc: clean
cmds:
Expand Down
8 changes: 5 additions & 3 deletions cmd/command/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ import (
"strings"
"syscall"

"github.com/fatih/color"

"github.com/easysoft/zentaoatf/internal/command/action"
"github.com/easysoft/zentaoatf/internal/server/core/cron"
"github.com/easysoft/zentaoatf/internal/server/core/web"

commandConfig "github.com/easysoft/zentaoatf/internal/command/config"
commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
unitHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/unit"
websocketHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/websocket"
"github.com/easysoft/zentaoatf/internal/server/core/cron"
"github.com/easysoft/zentaoatf/internal/server/core/web"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
i118Utils "github.com/easysoft/zentaoatf/pkg/lib/i118"
logUtils "github.com/easysoft/zentaoatf/pkg/lib/log"
stringUtils "github.com/easysoft/zentaoatf/pkg/lib/string"
"github.com/fatih/color"
)

var (
Expand Down
6 changes: 4 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import (
"os/signal"
"syscall"

"github.com/fatih/color"

"github.com/easysoft/zentaoatf/internal/server/core/web"

commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
websocketHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/websocket"
serverConfig "github.com/easysoft/zentaoatf/internal/server/config"
"github.com/easysoft/zentaoatf/internal/server/core/web"
httpUtils "github.com/easysoft/zentaoatf/pkg/lib/http"
logUtils "github.com/easysoft/zentaoatf/pkg/lib/log"
"github.com/fatih/color"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_cb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
apiTest "github.com/easysoft/zentaoatf/cmd/test/helper/zentao/api"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_ci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
apiTest "github.com/easysoft/zentaoatf/cmd/test/helper/zentao/api"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions cmd/test/cli/cli_clean_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"testing"
"time"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"

expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions cmd/test/cli/cli_co_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
Expand All @@ -35,7 +36,7 @@ var (
productRe = regexp.MustCompile("Please enter Product Id|请输入 产品Id")
moduleRe = regexp.MustCompile("Please enter Module Id|请输入 模块Id")
suiteRe = regexp.MustCompile("Please enter Suite Id|请输入 套件Id")
taskRe = regexp.MustCompile("Please enter Test Request Id|请输入 测试任务Id")
taskRe = regexp.MustCompile("Please enter Test Request Id|请输入 测试单Id")
separateRe = regexp.MustCompile("Save expected results in a separate file|是否将用例期待结果保存在独立的文件中")
storeRe = regexp.MustCompile("Where to store scripts|请输入脚本保存目录")
organizeRe = regexp.MustCompile("Organize test scripts by module|是否希望按模块ID组织脚本目录结构")
Expand Down Expand Up @@ -65,7 +66,6 @@ func (s *CoSuite) BeforeEach(t provider.T) {
}

// 当前禅道版本max4.3有bug,当前无法通过测试。bug已修复,未打包
//
func (s *CoSuite) TestCoProduct(t provider.T) {
t.Title("导出用例,不提供参数")
t.Require().Equal("Success", testCoProduct())
Expand Down
7 changes: 4 additions & 3 deletions cmd/test/cli/cli_cr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
apiTest "github.com/easysoft/zentaoatf/cmd/test/helper/zentao/api"
dateUtils "github.com/easysoft/zentaoatf/pkg/lib/date"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
successCrRe = regexp.MustCompile("Submitted test results to ZenTao|提交测试结果到禅道成功")
productIdRe = regexp.MustCompile("Please enter Product Id|请输入 产品Id")
taskIdRe = regexp.MustCompile("Please enter Test Request Id|请输入 测试任务Id")
taskIdRe = regexp.MustCompile("Please enter Test Request Id|请输入 测试单Id")
)

type CrSuite struct {
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_expect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_extract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_help_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"testing"
"time"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

type ListSuite struct {
Expand Down
7 changes: 4 additions & 3 deletions cmd/test/cli/cli_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

type RunSuite struct {
Expand Down Expand Up @@ -100,7 +101,7 @@ func (s *RunSuite) TestRunFileAndSubmitBug(t provider.T) {

func (s *RunSuite) TestRunZtfTask(t provider.T) {
t.ID("1589")
t.Title("执行禅道测试任务")
t.Title("执行禅道测试单")

cmd := commonTestHelper.GetZtfPath() + fmt.Sprintf(" run %scmd/test/demo -task 1", constTestHelper.RootPath)
expectReg := regexp.MustCompile(`Pass:0\(0\.0%\), Fail:3\(100\.0%\), Skip:0\(0\.0%\)|通过数:0\(0\.0%\),失败数:3\(100\.0%\),忽略数:0\(0\.0%\)`)
Expand Down
7 changes: 4 additions & 3 deletions cmd/test/cli/cli_run_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import (
"strings"
"testing"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
"github.com/go-git/go-git/v5"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
)

type RunUnitSuit struct {
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"testing"
"time"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/test/cli/cli_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"testing"
"time"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"

commonTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/common"
constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
expect "github.com/easysoft/zentaoatf/pkg/lib/expect"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)

type ViewSuite struct {
Expand Down
5 changes: 2 additions & 3 deletions cmd/test/coverage/cov_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package main

import (
"testing"

"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/runner"
"github.com/ozontech/allure-go/pkg/framework/suite"
"testing"
)

var ()

func testCov() (status string) {
return "pass"
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/test/helper/common/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"os"
"os/exec"

"github.com/go-git/go-git/v5"

constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"
"github.com/go-git/go-git/v5"
)

func CloneGit(gitUrl string, name string) error {
Expand Down
6 changes: 2 additions & 4 deletions cmd/test/helper/common/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import (
"time"

constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
commDomain "github.com/easysoft/zentaoatf/internal/pkg/domain"
execHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/exec"
zentaoHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/zentao"

serverDomain "github.com/easysoft/zentaoatf/internal/server/modules/v1/domain"
dateUtils "github.com/easysoft/zentaoatf/pkg/lib/date"
fileUtils "github.com/easysoft/zentaoatf/pkg/lib/file"

commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
serverDomain "github.com/easysoft/zentaoatf/internal/server/modules/v1/domain"
)

func TestCli(version string) (err error) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/test/helper/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"strings"

"github.com/bitly/go-simplejson"
"github.com/fatih/color"

commConsts "github.com/easysoft/zentaoatf/internal/pkg/consts"
logUtils "github.com/easysoft/zentaoatf/pkg/lib/log"
"github.com/fatih/color"
)

func Get(url, token string) (ret []byte, err error) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/test/helper/http/zentao.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package httpHelper

import (
"github.com/tidwall/gjson"

constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
zentaoHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/zentao"
"github.com/tidwall/gjson"
)

func Login() (ret string) {
Expand Down
6 changes: 4 additions & 2 deletions cmd/test/helper/zentao/api/zentao.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package apiTest
import (
"fmt"

"github.com/tidwall/gjson"

"github.com/easysoft/zentaoatf/cmd/test/restapi/config"

constTestHelper "github.com/easysoft/zentaoatf/cmd/test/helper/conf"
httpHelper "github.com/easysoft/zentaoatf/cmd/test/helper/http"
"github.com/easysoft/zentaoatf/cmd/test/restapi/config"
zentaoHelper "github.com/easysoft/zentaoatf/internal/pkg/helper/zentao"
"github.com/tidwall/gjson"
)

func GetCaseTitleById(id int) string {
Expand Down
Loading

0 comments on commit f73661c

Please sign in to comment.