Skip to content
Snippets Groups Projects
Commit 8067f3b2 authored by Christoph Witzko's avatar Christoph Witzko
Browse files

style: add .golangci-lint.yaml

parent 5eff7f1a
No related branches found
No related tags found
No related merge requests found
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
......@@ -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
}
......@@ -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")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment