Showing 407 of 1,235 total issues
Method engine.doKnativeHTTPRequest
has 8 return statements (exceeds 4 allowed). Open
func (engine *engine) doKnativeHTTPRequest(ctx context.Context,
ar *functionRequest, arReq *enginerefactor.ActionRequest,
) {
ctx, spanEnd, err := tracing.NewSpan(ctx, "executing knative request to action")
if err != nil {
Method actionLogic.scheduleAction
has 8 return statements (exceeds 4 allowed). Open
func (logic *actionLogic) scheduleAction(ctx context.Context, attempt int) error {
input, files, err := generateActionInput(ctx, &generateActionInputArgs{
Instance: logic.Instance,
Source: logic.GetInstanceData(),
Action: logic.Action,
Method SlackWebhookPlugin.Execute
has 8 return statements (exceeds 4 allowed). Open
func (p *SlackWebhookPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
// check request is already authenticated
if gateway.ExtractContextActiveConsumer(r) != nil {
return r
}
Method actionLogic.Run
has 8 return statements (exceeds 4 allowed). Open
func (logic *actionLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
// first schedule
if len(wakedata) == 0 {
err := noMemory(logic)
if err != nil {
Method logController.getNewer
has 8 return statements (exceeds 4 allowed). Open
func (m logController) getNewer(ctx context.Context, t time.Time, params map[string]string) ([]logEntry, error) {
var logs []core.LogEntry
var err error
// Determine the track based on the provided parameters
Method jxController.handler
has 8 return statements (exceeds 4 allowed). Open
func (c *jxController) handler(w http.ResponseWriter, r *http.Request) {
data, err := io.ReadAll(r.Body)
if err != nil {
return
}
Method Workflow.validate
has 8 return statements (exceeds 4 allowed). Open
func (o *Workflow) validate() error {
if len(o.States) == 0 {
return errors.New("workflow has no defined states")
}
Method Workflow.unmarshal
has 8 return statements (exceeds 4 allowed). Open
func (o *Workflow) unmarshal(m map[string]interface{}) error {
// split start out from the rest, and umarshal it
if err := o.unmStart(m); err != nil {
return err
}
Method events.handleEvent
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (events *events) handleEvent(ctx context.Context, ns *datastore.Namespace, ce *cloudevents.Event) error {
ctx = tracing.WithTrack(tracing.AddNamespace(ctx, ns.Name), tracing.BuildNamespaceTrack(ns.Name))
ctx, end, err := tracing.NewSpan(ctx, "handling event-messages")
if err != nil {
slog.Debug("GetListenersByTopic failed to init telemetry", "error", err)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function patchVarData
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func patchVarData(ctx context.Context, flowToken string, flowAddr string, namespace string, id string, body datastore.RuntimeVariablePatch) (int, error) {
Method engine.NewInstance
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (engine *engine) NewInstance(ctx context.Context, args *newInstanceArgs) (*instanceMemory, error) {
ctx = tracing.AddInstanceAttr(ctx, tracing.InstanceAttributes{
Namespace: args.Namespace.Name,
InstanceID: args.ID.String(),
Invoker: args.Invoker,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method JSOutboundPlugin.Execute
has 7 return statements (exceeds 4 allowed). Open
func (js *JSOutboundPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
var (
err error
b []byte
)
Method engine.enqueueInstanceMessage
has 7 return statements (exceeds 4 allowed). Open
func (engine *engine) enqueueInstanceMessage(ctx context.Context, id uuid.UUID, kind string, data interface{}) error {
// TODO: should this add state and step data? At some point these fields died so I have removed them.
payload, err := json.Marshal(map[string]interface{}{
"type": kind,
"data": data,
Function renderStartEventListener
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func renderStartEventListener(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, ms *muxStart, tx *database.SQLStore) error {
Method events.addInstanceEventListener
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
func (events *events) addInstanceEventListener(ctx context.Context, namespace uuid.UUID, nsName string, instance uuid.UUID, sevents []*model.ConsumeEventDefinition, all bool) error {
Method forEachLogic.Run
has 7 return statements (exceeds 4 allowed). Open
func (logic *forEachLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
// first schedule
if len(wakedata) == 0 {
err := noMemory(logic)
if err != nil {
Method instanceMemory.SetVariables
has 7 return statements (exceeds 4 allowed). Open
func (im *instanceMemory) SetVariables(ctx context.Context, vars []states.VariableSetter) error {
tx, err := im.engine.flow.beginSQLTx(ctx)
if err != nil {
return err
}
Method Manager.gc
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (d *Manager) gc() {
ctx := context.Background()
jitter := 1000
interval := time.Second * 10
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method eventsXorLogic.Run
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func (logic *eventsXorLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
first, err := scheduleTwice(logic, wakedata)
if err != nil {
return nil, err
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method server.getInstance
has 7 return statements (exceeds 4 allowed). Open
func (srv *server) getInstance(ctx context.Context, namespace, instanceID string) (*enginerefactor.Instance, error) {
id, err := uuid.Parse(instanceID)
if err != nil {
return nil, err
}