Showing 407 of 1,235 total issues
Method parallelLogic.Run
has 7 return statements (exceeds 4 allowed). Open
Open
func (logic *parallelLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
// first schedule
if len(wakedata) == 0 {
err := noMemory(logic)
if err != nil {
Method engine.Transition
has 7 return statements (exceeds 4 allowed). Open
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)
}
Method LocalServer.varHandler
has 7 return statements (exceeds 4 allowed). Open
Open
func (srv *LocalServer) varHandler(w http.ResponseWriter, r *http.Request) {
actionId := r.URL.Query().Get("aid")
srv.requestsLock.Lock()
req, ok := srv.requests[actionId]
Method LocalServer.setVar
has 7 return statements (exceeds 4 allowed). Open
Open
func (srv *LocalServer) setVar(ctx context.Context, ir *functionRequest, r io.Reader, scope, key, vMimeType string) (int, error) {
// Retrieve variable metadata
varMeta, statusCode, err := getVariableMetaFromFlow(ctx, srv.flowToken, srv.flowAddr, ir, scope, key)
if err != nil {
target := &RessourceNotFoundError{}
Method validateLogic.Run
has 7 return statements (exceeds 4 allowed). Open
Open
func (logic *validateLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
err := scheduleOnce(logic, wakedata)
if err != nil {
return nil, err
}
Function GetSource
has 7 return statements (exceeds 4 allowed). Open
Open
func GetSource(_ context.Context, cfg *datastore.MirrorConfig) (Source, error) {
insecureSkipTLS := cfg.Insecure
tempDir := ""
if cfg.AuthToken == "" {
Method instanceMemory.GetVariables
has 7 return statements (exceeds 4 allowed). Open
Open
func (im *instanceMemory) GetVariables(ctx context.Context, vars []states.VariableSelector) ([]states.Variable, error) {
x := make([]states.Variable, 0)
tx, err := im.engine.flow.beginSQLTx(ctx)
if err != nil {
Avoid deeply nested control flow statements. Open
Open
if (item && item.source === "startNode" && item.target === flow[i]) {
// connection between start and first state
(newElements[j] as Edge).animated = true;
}
Function NamespaceVariablePicker
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
const NamespaceVariablePicker = ({
namespace: givenNamespace,
defaultVariable,
onChange,
}: NamespaceVariablePickerProps) => {
- 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 FileUpload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
const FileUpload = ({ onChange }: FileUploadProps) => {
const { t } = useTranslation();
const [isUploading, setIsUploading] = useState(false);
const onFileLoad = (e: ProgressEvent<FileReader>) => {
- 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
Avoid deeply nested control flow statements. Open
Open
if (value.states[i]?.conditions[y]?.transition) {
newElements.push({
id: `${value.states[i]?.id}-${value.states[i]?.conditions[y]?.transition}-${i}-${y}`,
source: value.states[i]?.id || "",
target: value.states[i]?.conditions[y]?.transition || "",
Method sqlEventTopicsStore.Append
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (s *sqlEventTopicsStore) Append(ctx context.Context, namespaceID uuid.UUID, namespace string, eventListenerID uuid.UUID, topic string, filter string) error {
Avoid deeply nested control flow statements. Open
Open
} else if p, ok := params["trace"]; ok {
return "flow.trace" + p, nil
}
Avoid deeply nested control flow statements. Open
Open
if (value.states[i]?.events[j]?.transition) {
transitions = true;
newElements.push({
id: `${value.states[i]?.id}-${value.states[i]?.events[j]?.transition}`,
source: value.states[i]?.id || "",
Method varController.listRaw
has 7 return statements (exceeds 4 allowed). Open
Open
func (e *varController) listRaw(w http.ResponseWriter, r *http.Request) {
ns := extractContextNamespace(r)
db, err := e.db.BeginTx(r.Context())
if err != nil {
Avoid deeply nested control flow statements. Open
Open
if (item && item.target === flow[i] && item.source === flow[i - 1]) {
// connection between two states
(newElements[j] as Edge).animated = true;
} else if (item && item.id === flow[i]) {
if (
Method logController.mountRouter
has 7 return statements (exceeds 4 allowed). Open
Open
func (m *logController) mountRouter(r chi.Router) {
r.Get("/subscribe", m.stream)
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
params := extractLogRequestParams(r)
Function sseHandlefunc
has 7 return statements (exceeds 4 allowed). Open
Open
func sseHandlefunc(ctx context.Context, r *http.Request, c *eventsController, cursorTime time.Time, params []string) ([]CoursoredEvent, error) {
ns := chi.URLParam(r, "namespace")
if ns == "" {
return nil, fmt.Errorf("namespace can not be empty")
}
Avoid deeply nested control flow statements. Open
Open
if (value.states[i]?.catch[x]?.transition) {
transitions = true;
newElements.push({
id: `${value.states[i]?.id}-${value.states[i]?.catch[x]?.transition}`,
Avoid deeply nested control flow statements. Open
Open
if (!flow[i + 1]) {
for (let j = 0; j < newElements.length; j++) {
if (
(newElements[j] as Edge).source === flow[i] &&
(newElements[j] as Edge).target === "endNode" &&