ethereum / emacs-solidity

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

Flycheck not working: checker automatically disabled #15

Closed felipeagc closed 6 years ago

felipeagc commented 6 years ago

I have solc in /usr/bin/solc, but the flycheck checker doesn't seem to find it. I ran flycheck-verify-setup and this is what I got:

  solidity-checker (disabled)
    - may enable: Automatically disabled!
    - predicate:  t
    - executable: Not found

I tried setting the solc location manually but that did not work. Any idea of what the problem could be?

denisglotov commented 6 years ago

same here, any hints?

Flycheck version: 32snapshot (package: 20171214.1215)
Emacs version:    24.5.1
System:           x86_64-pc-linux-gnu
Window system:    nil
LefterisJP commented 6 years ago

I can reproduce this with latest flycheck. I have not updated flycheck in ages so I had not noticed this in my working environment. Will try to figure out a fix for this. Thanks for reporting it.

LefterisJP commented 6 years ago

@denisglotov and @felipeagc I added some patches that fix the issue at least in my emacs. Can you try with the latest version and see if that fixes the problems for you?

denisglotov commented 6 years ago

@LefterisJP, thanks for the prompt reply. I see your changes in repo, but elpa version is still solidity-mode-20171113.1058. Will it automatically update anytime soon?

LefterisJP commented 6 years ago

@denisglotov if you use melpa you will have to wait until the entire mepla repository is rebuilt. Check here: https://melpa.org/#/

Says last build started 3 hours ago.

LefterisJP commented 6 years ago

@denisglotov should be done now.

denisglotov commented 6 years ago

@LefterisJP, yes, it is working for me. Just note, that emits the following In end of data: solidity-mode.el:483:1:Warning: the function `flycheck-register-option-var' might not be defined at runtime. if required before flycheck.

denisglotov commented 6 years ago

@LefterisJP, do you use solidity-checker with solium or solchint? Yes, I wrote a script that starts solium properly and pointed solidity-solc-path to the script. I just wonder if there is a better way to use the linters?

LefterisJP commented 6 years ago

hmmm what do you mean? I just have something like this in my init file:

(require 'flycheck)
(setq solidity-solc-path "/path/to/solc")
(require 'solidity-mode)
denisglotov commented 6 years ago

I meant that if someone does not use flycheck, he will see the warning.

And if you asked about linters, here is what I did to use solium: https://github.com/denisglotov/.emacs.d/blob/master/lisp/init-solidity.el https://github.com/denisglotov/.emacs.d/blob/master/bin/solc-solium-wrapper.sh This looks like a hack so I wondered is there is a nicer way to use solium (or solchint).

LefterisJP commented 6 years ago

@denisglotov

Oh I see. I also get those warnings but I have not found a good way to separate them nicely if the user does not have flycheck. I will look further. I am by no means an elisp expert.

As for the linters, yes this is a hack. I actually don't know what this linter is. I guess it's this one: https://github.com/duaraghav8/Solium

I don't like the style suggestions of that linter, but the security ones could be good.

I can add it as a separate flycheck checker to be activated at solidity mode. Give me some time and will do it over the holidays.

denisglotov commented 6 years ago

@LefterisJP, this is where I look for available liners: http://solidity.readthedocs.io/en/develop/index.html?highlight=lint. I haven't tried solhint yet, just solium has more stars on github.

duaraghav8 commented 6 years ago

I don't like the style suggestions ^Thanks for the feedback @LefterisJP. Solium (and I believe every other linter) follows Solidity's style guide for style suggestions. I personally don't like some of them. That's why these rules are configurable or you can even switch them off altogether in case you disagree with any. But I'd love to hear you out in case you think there could be better, more useful suggestions.

denisglotov commented 6 years ago

@LefterisJP, it is working fine now, thank you for the good job. As a wishlist I can think of setting solium config path dynamically relative to the contract itself. Like https://github.com/denisglotov/.emacs.d/blob/master/lisp/init-javascript.el#L9. Because, when one is working on multiple Ethereum projects, he needs to change the config location every time he switches between the projects. (I hoped I could contribute with pull request about this, but not sure when can I find the time to). Anyway, Happy new year! :)

LefterisJP commented 6 years ago

@denisglotov that can be done. For now I also have the option to set the config path to one global file so that all contracts use the same one no matter where the contract is located. Can you at least make an issue describing your wish so that I can try to addres it?

Happy new year! :)