ethereum / emacs-solidity

The official solidity-mode for EMACS
GNU General Public License v3.0
206 stars 66 forks source link

Integrate with Solium linter #17

Closed LefterisJP closed 6 years ago

LefterisJP commented 6 years ago

@denisglotov this one is for you

This PR adds integration of Emacs solidity mode and flycheck with the solium linter.

At this point you now need to specify the path to the solc or the path to the solium binary via solidity-solc-path or solidity-solium-path respectively. Reason is that in some configurations, solc may be added to the path after emacs is launched (e.g. systemd) so it's always good practise to have it explicitly specified.

Moreover since now we can have multiple flycheck checkers you need to specify the active flycheck checker. That is done via the solidity-flycheck-active-checker option which can either be "solc" or "solium".

Finally check the README for possible configuration options of solium and solc.

denisglotov commented 6 years ago

@LefterisJP, I'd say that solidity-checker should be split to solidity-solc-checker and solidity-solium-checker, so that they could work together! Ask yourself: do you want to keep switching your checkers to see all errors that your edited code currently have. That's why I stay with my solc-solium-wrapper.sh hack. But I began to see this message Solidity Mode Configuration error. Requested solc flycheck integration but can't find solc at: solc, do you know why?

LefterisJP commented 6 years ago

There are now 2 different checkers.

One is for solc and one is for solium. From what I saw solium is a superset of solidity, so having them both on would be a lot of noise so I am not letting it right now. If that's not the case I can change it.

The error you got is because you need to provide the full patch to solc now as per the readme.

denisglotov commented 6 years ago

@LefterisJP, I am not heavily experienced in solium, but here is what I see: if I introduce syntax error (e.g. function -> xxxfunction), both emit errors. But if I introduce logic error (e.g. change the name of a variable at declaration point but not at usage points), solium is OK with that, only solc complains (Error: Undeclared identifier). So I think they are needed both.

LefterisJP commented 6 years ago

I see. In that case I am enabling chaining of the checkers with a new PR: https://github.com/ethereum/emacs-solidity/pull/18