vscode-solidity
vscode-solidity copied to clipboard
Solhint Recommeded rules not working // being detected
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:


- With these rules the extension inside VSCode does not report any error.
- With these rules manually linting the file with
npx solhint ...does not report any error either.
Test with recommended linting options:


- With these rules the extension inside VSCode does not report any error.
- With these rules manually linting the file with
npx solhint...does report errors:

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)
@juanfranblanco friendly ping
I wonder if it's related to - https://github.com/juanfranblanco/vscode-solidity/issues/169
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.
@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.



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.
It appears that this plugin does not work with solhint 0.3.x?
@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.