node-red / nrlint

Node-RED Flow Linter
Apache License 2.0
36 stars 15 forks source link

"loop detected" in non-looping flow #12

Closed fvbommel closed 3 years ago

fvbommel commented 3 years ago

Current Behavior

The linter reports "loop detected" for a simple flow that does not contain a loop (see below). The message points to the second change node ("Compare").

Expected Behavior

Non-existent loops are not detected.

Steps To Reproduce

Import the flow below and look at the linter messages in the editor.

Example flow

[
    {
        "id": "b39049ef54640900",
        "type": "switch",
        "z": "b26f943b225b40c3",
        "name": "Succeeded?",
        "property": "payload.ok",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 270,
        "y": 60,
        "wires": [
            [
                "b50626390c288a83"
            ],
            [
                "1c339808c9e0e3a9"
            ]
        ]
    },
    {
        "id": "1c339808c9e0e3a9",
        "type": "debug",
        "z": "b26f943b225b40c3",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 570,
        "y": 120,
        "wires": []
    },
    {
        "id": "b50626390c288a83",
        "type": "switch",
        "z": "b26f943b225b40c3",
        "name": "Compare",
        "property": "prop",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "payload.value",
                "vt": "msg"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 440,
        "y": 60,
        "wires": [
            [
                "1c339808c9e0e3a9"
            ]
        ]
    },
    {
        "id": "f51dce4370a546fc",
        "type": "inject",
        "z": "b26f943b225b40c3",
        "name": "",
        "props": [
            {
                "p": "prop",
                "v": "foo",
                "vt": "str"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"ok\":true, \"value\": \"bar\"}",
        "payloadType": "json",
        "x": 110,
        "y": 60,
        "wires": [
            [
                "b39049ef54640900"
            ]
        ]
    }
]

Environment