feat: adding a delete_event #340
reviewdog [golangci] report
reported by reviewdog 🐶
Findings (4)
library/actions/delete.go|3| 3-83 lines are duplicate of library/actions/push.go:4-84
(dupl)
library/actions/delete_test.go|103 col 2| redefines-builtin-id: redefinition of the built-in function delete (revive)
library/events_test.go|158 col 2| redefines-builtin-id: redefinition of the built-in function delete (revive)
library/repo.go|827 col 2| naked return in func EventAllowed
with 31 lines of code (nakedret)
Filtered Findings (0)
Annotations
Check failure on line 3 in library/actions/delete.go
github-actions / golangci
[golangci] library/actions/delete.go#L3
3-83 lines are duplicate of `library/actions/push.go:4-84` (dupl)
Raw output
library/actions/delete.go:3: 3-83 lines are duplicate of `library/actions/push.go:4-84` (dupl)
package actions
import "github.com/go-vela/types/constants"
// Delete is the library representation of the various actions associated
// with the delete event webhook from the SCM.
type Delete struct {
Branch *bool `json:"branch"`
Tag *bool `json:"tag"`
}
// FromMask returns the Delete type resulting from the provided integer mask.
func (a *Delete) FromMask(mask int64) *Delete {
a.SetBranch(mask&constants.AllowDeleteBranch > 0)
a.SetTag(mask&constants.AllowDeleteTag > 0)
return a
}
// ToMask returns the integer mask of the values for the Delete set.
func (a *Delete) ToMask() int64 {
mask := int64(0)
if a.GetBranch() {
mask = mask | constants.AllowDeleteBranch
}
if a.GetTag() {
mask = mask | constants.AllowDeleteTag
}
return mask
}
// GetBranch returns the Branch field from the provided Delete. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (a *Delete) GetBranch() bool {
// return zero value if Delete type or Branch field is nil
if a == nil || a.Branch == nil {
return false
}
return *a.Branch
}
// GetTag returns the Tag field from the provided Delete. If the object is nil,
// or the field within the object is nil, it returns the zero value instead.
func (a *Delete) GetTag() bool {
// return zero value if Delete type or Tag field is nil
if a == nil || a.Tag == nil {
return false
}
return *a.Tag
}
// SetBranch sets the Delete Branch field.
//
// When the provided Delete type is nil, it
// will set nothing and immediately return.
func (a *Delete) SetBranch(v bool) {
// return if Events type is nil
if a == nil {
return
}
a.Branch = &v
}
// SetTag sets the Delete Tag field.
//
// When the provided Delete type is nil, it
// will set nothing and immediately return.
func (a *Delete) SetTag(v bool) {
// return if Events type is nil
if a == nil {
return
}
a.Tag = &v
}
Check failure on line 103 in library/actions/delete_test.go
github-actions / golangci
[golangci] library/actions/delete_test.go#L103
redefines-builtin-id: redefinition of the built-in function delete (revive)
Raw output
library/actions/delete_test.go:103:2: redefines-builtin-id: redefinition of the built-in function delete (revive)
delete := new(Delete)
^
Check failure on line 158 in library/events_test.go
github-actions / golangci
[golangci] library/events_test.go#L158
redefines-builtin-id: redefinition of the built-in function delete (revive)
Raw output
library/events_test.go:158:2: redefines-builtin-id: redefinition of the built-in function delete (revive)
delete := new(actions.Delete)
^
Check failure on line 827 in library/repo.go
github-actions / golangci
[golangci] library/repo.go#L827
naked return in func `EventAllowed` with 31 lines of code (nakedret)
Raw output
library/repo.go:827:2: naked return in func `EventAllowed` with 31 lines of code (nakedret)
return
^