vscode-solidity icon indicating copy to clipboard operation
vscode-solidity copied to clipboard

Having a `.solhint.json` with custom rules breaks the Solidity compiler server

Open Jaime-Iglesias opened this issue 5 years ago • 12 comments

Screenshot from 2020-05-23 19-07-12

I've noticed that my extension was not telling me about errors, like unused parameters and stuff like that, then I noticed the message about the Solidity server crashing.

At first it was complaining about some custom rules that I have (They are for solhint 2.x), then I removed the rules (but left the .solhint.json) then it complained about it being empty. After I completely removed the .solhint.json file it did not stop crashing.

  • Temportal fix: Removing the .solhint.json

Jaime-Iglesias avatar May 23 '20 18:05 Jaime-Iglesias

Thanks, I have upgraded to solhint 3.0 on the latest release, I did not experienced any issues on my side even using a JSON file... obviously not enough :(

juanfranblanco avatar May 23 '20 20:05 juanfranblanco

Thanks, I have upgraded to solhint 3.0 on the latest release, I did not experienced any issues on my side even using a JSON file... obviously not enough :(

I will try installing the latest solhint version locally and use some custom rules that I already have for 3.0, I'll tell you how that goes :D

Jaime-Iglesias avatar May 23 '20 20:05 Jaime-Iglesias

image image

juanfranblanco avatar May 24 '20 07:05 juanfranblanco

So, after some extra testing I've come to the following conclusions:

  1. The solhint version is not the problem.
  2. Having a .solhint.json is not the problem.
  3. The problem is having custom rules.
  • The error. Screenshot from 2020-05-24 12-03-51
  • My .solhint.json file. Screenshot from 2020-05-24 12-04-43
  • My package.json Screenshot from 2020-05-24 12-05-19

EDIT:

I wonder if this - https://github.com/protofire/solhint/issues/206 - will fix it.

Jaime-Iglesias avatar May 24 '20 11:05 Jaime-Iglesias

Ah what you meant by custom rules was your plugins, not your specific rules. Yes that needs to be fixed by the solhint guys... the same as before..

juanfranblanco avatar May 25 '20 08:05 juanfranblanco

Ah what you meant by custom rules was your plugins, not your specific rules. Yes that needs to be fixed by the solhint guys... the same as before..

Yeah, the problem is that it now crashes the Solidity Compiler Server which it didn't before :(

Jaime-Iglesias avatar May 25 '20 11:05 Jaime-Iglesias

I'm wrestling with a similar issue now, after having recently upgraded to [email protected]. Some obvious errors are correctly highlighted:

Capture d’écran 2021-04-27 à 16 40 01

But others, such as incorrect types, are not (underlyingOut should be an uint256):

Capture d’écran 2021-04-27 à 16 42 35

This is with [email protected]. Deleting .solhint.json didn't fix this.

PaulRBerg avatar Apr 27 '21 13:04 PaulRBerg

@paulrberg custom rules are not supported as it needs further work from solhint, mainly a way to inject those custom rules into the plugin. As those rules need to be loaded dynamically and found. Mainly in the user repo or something like that.

juanfranblanco avatar Apr 27 '21 13:04 juanfranblanco

I don't think I am using custom rules. This is my .solhint.json file.

Also the type error above is not triggered by solhint, but the solidity compiler itself.

PaulRBerg avatar Apr 27 '21 18:04 PaulRBerg

Yes you are using the "prettier" plugin @paulrberg

juanfranblanco avatar Apr 28 '21 08:04 juanfranblanco

Ah so that's what you mean by custom rules. Gotcha.

Tagging @fvictorio (creator of the prettier plugin), in case he knows how to patch this.

PaulRBerg avatar Apr 28 '21 09:04 PaulRBerg

@paulrberg we have some thread there https://github.com/protofire/solhint/issues/206

juanfranblanco avatar Apr 28 '21 13:04 juanfranblanco