MCPcopy Create free account
hub / github.com/git-bug/git-bug / Validate

Method Validate

entities/bug/op_create.go:67–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67func (op *CreateOperation) Validate() error {
68 if err := op.OpBase.Validate(op, CreateOp); err != nil {
69 return err
70 }
71
72 if text.Empty(op.Title) {
73 return fmt.Errorf("title is empty")
74 }
75 if !text.SafeOneLine(op.Title) {
76 return fmt.Errorf("title has unsafe characters")
77 }
78
79 if !text.Safe(op.Message) {
80 return fmt.Errorf("message is not fully printable")
81 }
82
83 return nil
84}
85
86func NewCreateOp(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) *CreateOperation {
87 return &CreateOperation{

Callers

nothing calls this directly

Calls 5

EmptyFunction · 0.92
SafeOneLineFunction · 0.92
SafeFunction · 0.92
ErrorfMethod · 0.80
ValidateMethod · 0.65

Tested by

no test coverage detected