Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
condition-gitlab
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
go-semantic-release
condition-gitlab
Commits
8067f3b2
Commit
8067f3b2
authored
2 years ago
by
Christoph Witzko
Browse files
Options
Downloads
Patches
Plain Diff
style: add .golangci-lint.yaml
parent
5eff7f1a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.golangci.yaml
+25
-0
25 additions, 0 deletions
.golangci.yaml
pkg/condition/gitlab.go
+3
-4
3 additions, 4 deletions
pkg/condition/gitlab.go
pkg/condition/gitlab_test.go
+1
-1
1 addition, 1 deletion
pkg/condition/gitlab_test.go
with
29 additions
and
5 deletions
.golangci.yaml
0 → 100644
+
25
−
0
View file @
8067f3b2
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
This diff is collapsed.
Click to expand it.
pkg/condition/gitlab.go
+
3
−
4
View file @
8067f3b2
...
...
@@ -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
(
"
T
his test run is not running on a branch build
.
"
)
return
fmt
.
Errorf
(
"
t
his test run is not running on a branch build"
)
}
if
branch
:=
gl
.
GetCurrentBranch
();
defaultBranch
!=
"*"
&&
branch
!=
defaultBranch
{
return
fmt
.
Errorf
(
"
T
his test run was triggered on the branch %s, while semantic-release is configured to only publish from %s
.
"
,
branch
,
defaultBranch
)
return
fmt
.
Errorf
(
"
t
his test run was triggered on the branch %s, while semantic-release is configured to only publish from %s"
,
branch
,
defaultBranch
)
}
return
nil
}
This diff is collapsed.
Click to expand it.
pkg/condition/gitlab_test.go
+
1
−
1
View file @
8067f3b2
...
...
@@ -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
,
"
T
his test run is not running on a branch build
.
"
)
assert
.
EqualError
(
t
,
err
,
"
t
his test run is not running on a branch build"
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment