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 error/wraning not showing up #144

Open wighawag opened 5 years ago

wighawag commented 5 years ago

I wanted to switch to solhint for linting my code but vscode-solidity does not show any error or warning when I configure solhint via "solidity.linter" : "solhint" config.

When I run solhint via

solhint -f table src/**/*.sol

it shows a lot of warning and errors

Also when I use solium, it shows the error correctly

What can be wrong ?

wighawag commented 5 years ago

I use

this mi .solhint.json :

{
  "extends": ["solhint:recommended"],
  "rules": {
    "avoid-throw": false,
    "avoid-suicide": "error",
    "avoid-sha3": "warn",
    "no-empty-blocks": false
  }
}
juanfranblanco commented 5 years ago

@wighawag thanks for reporting this, did you change enabledSolium to false, as this may cause an issue. https://github.com/juanfranblanco/vscode-solidity/blob/master/src/server.ts#L252

wighawag commented 5 years ago

I tried setting it to false and leaving it undefined and it was not working either way

jjgonecrypto commented 4 years ago

I believe this is due to this extension not handling "extends": ["solhint:recommended"] properly. Any warning / error in a rule works as expected but not the recommended set.

juanfranblanco commented 4 years ago

@justinjmoses thanks for that, ill put that in the next release. The expectation is to have just the rules: https://github.com/juanfranblanco/vscode-solidity/blob/master/src/linter/solhint.ts#L66-L71

jjgonecrypto commented 4 years ago

Hmmm - I'm on 0.0.72 now and the plugin is still not adhering to solhint:recommended items... For instance if you checkout our code (https://github.com/Synthetixio/synthetix), npm install, then lookup contracts/LimitedSetup.sol in VSCode say, you won't see warnings. Yet if you run npx solhint contracts/*.sol you'll see state-visibility warnings. If you add "state-visibility": "warn" to .solhint.json then the warnings come up in vscode as expected.

stoplion commented 3 years ago

Is there a work around for this? I'm not seeing any linting errors n VScode

paulcoffee85 commented 1 year ago

{ "extends": ["solhint:recommended"], "rules": { "avoid-throw": false, "avoid-suicide": "error", "avoid-sha3": "warn", "no-empty-blocks": false } }

You are a genius. This setup finally got my solhint to work. thank you much