Showing 407 of 1,235 total issues
Method setterLogic.Run
has 10 return statements (exceeds 4 allowed). Open
func (logic *setterLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
err := scheduleOnce(logic, wakedata)
if err != nil {
return nil, err
}
Method fsController.updateFile
has 10 return statements (exceeds 4 allowed). Open
func (e *fsController) updateFile(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
db, err := e.db.BeginTx(r.Context())
if err != nil {
Consider simplifying this complex logical expression. Open
if (value.states) {
for (let i = 0; i < value.states.length; i++) {
let transitions = false;
// check if starting element
if (i === 0) {
Method eventsXorLogic.Run
has 9 return statements (exceeds 4 allowed). Open
func (logic *eventsXorLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
first, err := scheduleTwice(logic, wakedata)
if err != nil {
return nil, err
}
Method events.handleEvent
has 9 return statements (exceeds 4 allowed). 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)
Method engine.Transition
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func (engine *engine) Transition(ctx context.Context, im *instanceMemory, nextState string, attempt int) *states.Transition {
ctx, cleanup, err := tracing.NewSpan(ctx, "engine transitions: "+nextState)
if err != nil {
slog.Debug("transition 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
Method consumeEventLogic.Run
has 9 return statements (exceeds 4 allowed). Open
func (logic *consumeEventLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
first, err := scheduleTwice(logic, wakedata)
if err != nil {
return nil, err
}
Function getReferencedFile
has 9 return statements (exceeds 4 allowed). Open
func getReferencedFile(ctx context.Context, flowToken, flowAddr, namespace string, path string) ([]byte, int, error) {
addr := fmt.Sprintf("http://%v/api/v2/namespaces/%v/files/%v", flowAddr, namespace, path)
var d []byte
resp, err := doRequest(ctx, http.MethodGet, flowToken, addr, nil)
Method FileQuery.SetPath
has 9 return statements (exceeds 4 allowed). Open
func (q *FileQuery) SetPath(ctx context.Context, path string) error {
path, err := filestore.SanitizePath(path)
if err != nil {
return fmt.Errorf("%w: %w", filestore.ErrInvalidPathParameter, err)
}
Function TargetPluginForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const TargetPluginForm: FC<TargetPluginFormProps> = ({
form,
onSave,
}) => {
const availablePlugins = useAvailablePlugins();
- 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 InstancesListPage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const InstancesListPage = () => {
const [offset, setOffset] = useState(0);
const [filters, setFilters] = useState<FiltersObj>({});
const { t } = useTranslation();
const { data, isSuccess, isAllowed, noPermissionMessage } = useInstances({
- 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 RoutesTable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const RoutesTable = ({
search,
filteredRoutes,
}: {
search: string;
- 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 appendEventListenersToDB
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
func appendEventListenersToDB(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, lifespan time.Duration, ms *muxStart, tx *database.SQLStore) error {
Function Initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
func Initialize(app core.App, db *database.SQLStore, bus *pubsub2.Bus, instanceManager *instancestore.InstanceManager, wakeByEvents events.WakeEventsWaiter, startByEvents events.WorkflowStart, circuit *core.Circuit) error {
Method engine.NewInstance
has 8 return statements (exceeds 4 allowed). 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,
Function generateGetInstancesFilters
has 8 return statements (exceeds 4 allowed). Open
func generateGetInstancesFilters(opts *instancestore.ListOpts) ([]string, []interface{}, error) {
if opts == nil {
return []string{}, []interface{}{}, nil
}
Method getterLogic.Run
has 8 return statements (exceeds 4 allowed). Open
func (logic *getterLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
err := scheduleOnce(logic, wakedata)
if err != nil {
return nil, err
}
Method LocalServer.logHandler
has 8 return statements (exceeds 4 allowed). Open
func (srv *LocalServer) logHandler(w http.ResponseWriter, r *http.Request) {
actionId := r.URL.Query().Get("aid")
srv.requestsLock.Lock()
req, ok := srv.requests[actionId]
Method flow.cronHandler
has 8 return statements (exceeds 4 allowed). Open
func (flow *flow) cronHandler(data []byte) {
ctx := context.Background()
t := time.Now().Truncate(time.Minute).UTC()
Method eventsAndLogic.Run
has 8 return statements (exceeds 4 allowed). Open
func (logic *eventsAndLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
first, err := scheduleTwice(logic, wakedata)
if err != nil {
return nil, err
}