nowarp / misti

TON Static Analyzer
https://nowarp.io/tools/misti
Apache License 2.0
23 stars 0 forks source link

Findings disappear when I add another entry in tact project config #96

Open Gusarich opened 1 month ago

Gusarich commented 1 month ago

FIRST RUN (1 entry in config)

Sources

tact.config.json

{
    "projects": [
        {
            "name": "contract",
            "path": "./contracts/contract.tact",
            "output": "./build"
        }
    ]
}

contract.tact

import "./constants.tact"; // unused import

contract Test {
    receive() {}
}

constants.tact

const SOMETHING: Int = 123;

Result

contracts/constants.tact:1:1:
> 1 | const SOMETHING: Int = 123;
      ^
Constant is never used

SECOND RUN (2 entries in config)

Sources

tact.config.json

{
    "projects": [
        {
            "name": "contract",
            "path": "./contracts/contract.tact",
            "output": "./build"
        },
        {
            "name": "another",
            "path": "./contracts/another.tact",
            "output": "./build"
        }
    ]
}

contract.tact

import "./constants.tact"; // unused import

contract Test {
    receive() {}
}

another.tact

contract Another {
    receive() {}
}

constants.tact

const SOMETHING: Int = 123;

Result

No findings

jubnzv commented 2 weeks ago

Related to https://github.com/nowarp/misti/pull/65.

Some detectors suppress warnings if they don't raise in other project entries. In this example the analyzer expects that another.tact will raise the same neverAccessedVariable warning.

However, this should be done only if those project files import the same files. Therefore, #60 needs to be implemented first.

I prefer to have false negatives for two dead code detectors rather than getting false positives, so I'll leave it as it is until #60 is implemented.