diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f5c0478c05e1ef02a4b48be0866a2b8874659675 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,25 @@ +linters: + enable: + - errorlint + - forbidigo + - gochecknoinits + - gocritic + - goconst + - gocyclo + - gofumpt + - goimports + - misspell + - revive + - unconvert + - unparam + - wastedassign + +linters-settings: + gocyclo: + min-complexity: 12 + gofumpt: + extra-rules: true + govet: + enable-all: true + disable: + - fieldalignment diff --git a/pkg/condition/gitlab.go b/pkg/condition/gitlab.go index 5aab319ffaaef18dc341dd2722da6a3c0c7fb4f9..517d2b63dac8894eae7bc90785d42b02f5b202ad 100644 --- a/pkg/condition/gitlab.go +++ b/pkg/condition/gitlab.go @@ -7,8 +7,7 @@ import ( var CIVERSION = "dev" -type GitLab struct { -} +type GitLab struct{} func (gl *GitLab) Name() string { return "GitLab CI" @@ -33,10 +32,10 @@ func (gl *GitLab) IsBranchRef() bool { func (gl *GitLab) RunCondition(config map[string]string) error { defaultBranch := config["defaultBranch"] if !gl.IsBranchRef() { - return fmt.Errorf("This test run is not running on a branch build.") + return fmt.Errorf("this test run is not running on a branch build") } if branch := gl.GetCurrentBranch(); defaultBranch != "*" && branch != defaultBranch { - return fmt.Errorf("This test run was triggered on the branch %s, while semantic-release is configured to only publish from %s.", branch, defaultBranch) + return fmt.Errorf("this test run was triggered on the branch %s, while semantic-release is configured to only publish from %s", branch, defaultBranch) } return nil } diff --git a/pkg/condition/gitlab_test.go b/pkg/condition/gitlab_test.go index 1c127b2907de0698a9f69bfa9ac62987cc139719..e72d41eec154ba375cc32da00dbe3242ebb65cc5 100644 --- a/pkg/condition/gitlab_test.go +++ b/pkg/condition/gitlab_test.go @@ -11,5 +11,5 @@ func TestGitlabValid(t *testing.T) { gl := GitLab{} os.Setenv("CI_COMMIT_BRANCH", "") err := gl.RunCondition(map[string]string{"defaultBranch": ""}) - assert.EqualError(t, err, "This test run is not running on a branch build.") + assert.EqualError(t, err, "this test run is not running on a branch build") }