juanfranblanco / vscode-solidity

Visual Studio Code language support extension for Solidity smart contracts in Ethereum https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
MIT License
885 stars 189 forks source link

Solhint Recommeded rules not working // being detected #170

Open Jaime-Iglesias opened 4 years ago

Jaime-Iglesias commented 4 years ago

Linting the following code:

pragma solidity 0.6.4;

contract IFoo {

    uint256 internal a;
    uint256 internal _b;
    uint256 private _c;
    string constant x = "abc";

    function _foo(uint256 _param1, uint256 param2) external pure returns (uint256 something, uint256) {
        uint256 some = _param1 + param2;
        return (some, 1);
    }

    function _fooo(uint256 param1, uint256 param2) internal pure returns (uint256, uint256) {
        uint256 some = param1 + param2;
        return (some, 1);
    }
}

Test with default linting options:

test

test

Test with recommended linting options:

test

test

test

From what I can gather from some tests I've performed, the .solhint.json is being read by the extension, for example if I change the pragma to 0.6.3 the rule compiler-version is enforced (both in default and in recommended). Also, the settings.json from the extension is being read since if I use the sha3 function the rule avoid-sha3 gets triggered (also in both cases)

Jaime-Iglesias commented 4 years ago

@juanfranblanco friendly ping

I wonder if it's related to - https://github.com/juanfranblanco/vscode-solidity/issues/169

juanfranblanco commented 4 years ago

Sorry I did not see this, actually the extension defaults to the recommended options, it might be a versioning issue, the extension is using 2.3.1.

Jaime-Iglesias commented 4 years ago

@juanfranblanco I did some further testing and it does not seem to be related to the solhint version. Linting manually keeps on giving the correct warnings while the extension indicates no problems.

test

test

test

juanfranblanco commented 4 years ago

hmm interesting it might be related, it should have picked the other warnings as it defaults to recommended. This used to work before, so it might have been a change.

petejkim commented 4 years ago

It appears that this plugin does not work with solhint 0.3.x?

AlissonRS commented 8 months ago

@petejkim it works now as this extension is using solhint 3.4.0 (at the time of writing), but maybe when you wrote your comment it was still using 2.x.x version.