GithubHelp home page GithubHelp logo

Comments (26)

LefterisJP avatar LefterisJP commented on September 18, 2024 2

@avatar-lavventura I have actually never used solium myself as I don't like its style suggestions. It was added by @rowanthorpe in this PR: #35

If I find some time I will check it out later. First solc flycheck definitely needs fixing.

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

Hey @avatar-lavventura you need to add a

(require 'solidity-flycheck)

before

(require 'solidity-mode)

as per the readme.

Does this solve your problem? Remember to re-byte-compile any files before trying again.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

I have done it but it did'nt solve the problem :( Is there anything else I can try?

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

Did you make sure to byte recompile your emacs .el files? With M-x flycheck-select-checker do you see the solidity-checker in there? If not then that mean that for some reason the 'solidity-flycheck module is not loaded. Any errors in your *Messages* buffer?

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

M-x package install 'solidity-flycheck' installs version 0.1.0.

I have install everything from scratch but still flycheck does not work:

=> flycheck-verify-setup and this is what I got:

Syntax checkers for buffer eBlocBroker.sol in solidity-mode:

  solium-checker
    - may enable: yes
    - predicate:  t
    - executable: Found at /Users/alper/.npm-packages/bin/solium

  solidity-checker
    - may enable: yes
    - predicate:  t
    - executable: Found at /usr/local/bin/solc

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 31
Emacs version:    26.3
System:           x86_64-apple-darwin19.0.0
Window system:    nil

Final setup:

(require 'flycheck)
;; (el-get 'solidity-flycheck)
(load "solidity-flycheck")

(setq solidity-solium-path "/Users/alper/.npm-packages/bin/solium")
(setq solidity-solc-path "/usr/local/bin/solc") ;; This better be set before requiring solidity mode.


(add-to-list 'flycheck-checkers 'solidity-checker)
(add-to-list 'flycheck-checkers 'solium-checker)

(setq flycheck-solidity-solc-addstd-contracts t)
(setq solidity-flycheck-solc-checker-active t)
(setq solidity-flycheck-solium-checker-active t)

(load "solidity-mode")

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

You don't need to use (load ...). `(require ...) is better for this.

And are you 100% sure it's not activated? You got both activated judging from the pasted output of flycheck-verify-setup.

Why are you adding them manually to the flycheck checkers? If you got the (setq solidity-flycheck-solc-checker-active t) before requiring solidity flycheck, then that should be done automatically. And also the callback to run flycheck with that checker in .sol files.

Here take a look at my configuraiton:

https://github.com/LefterisJP/.emacs/blob/ccec8c5e33c1afc4755dd2cd11f1a8d9572fe1e4/el-get-user/init_files/init-solidity-mode.el#L6-L20

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

I work on .sol files like emacs -nw Test.sol.

On both approaches, solidity-mode works where the font color changes. But flycheck does not work like it does on python files.

In order to check activated, I typed uin foo or change keywords inside my .sol file, where there was no warning message generated, or their color changes to red or yellow.

I have tried two different approach.

M-x => package-install => solidity-mode
M-x => package-install => solidity-flychecker
Installs into /elpha/solidity-flycheck-0.1.9, but the file's version shows up as 0.1.0. So in this approach flycheck does not work.

I removed solidity-* files under /elpha/. Then I install through el-get, so it installs into el-get/solidity-mode where when I try to use (require ...) I get an error where it cannot find the file, so I use (load ...).

I get this message when I use requre: Cannot open load file: No such file or directory, solidity-common // but solidity-common exist under el-get/solidity-mode.


This I what I get when I use your configuration:

Syntax checkers for buffer eBlocBroker.sol in solidity-mode:

  solidity-checker
    - may enable: yes
    - predicate:  t
    - executable: Found at /usr/local/bin/solc


The following syntax checkers are not registered:

  - solium-checker

Try adding these syntax checkers to `flycheck-checkers'.  Flycheck
Mode is disabled.  Use C-u M-x flycheck-disable-checker to enable
disabled checkers.

--------------------

Flycheck version: 31
Emacs version:    26.3
System:           x86_64-apple-darwin19.0.0
Window system:    nil

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

If you see solidity-checker when you do flycheck-verify-setup it means that it's activated and loaded from solidity-mode side.

If it does not work for your from that point on I don't know what could be wrong. Perhaps something is wrong with your flycheck setup.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

I can see solidity-checker. I didn't change any flycheck setup :/

I added following line as well which didn't help (add-hook 'after-init-hook #'global-flycheck-mode)

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

Seems like working for only Stack too deep, but sees solidity-checker as not the recent version:

Suspicious state from syntax checker solidity-checker: Flycheck checker solidity-checker returned non-zero exit code 1, but its output contained no errors: Compiler error: Stack too deep, try removing local vari\
ables.
   --> /Users/alper/eBlocBroker/contract/contracts/flycheck_eBlocBroker.sol:208:111:
    |
208 |  ... .jobID].mul(args.executionDuration[args.jobID])).add(info.priceDataTransfe ...
    |                                         ^^^^


Try installing a more recent version of solidity-checker, and please open a bug report if the issue persists in the latest release.  Thanks!

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

@avatar-lavventura Solidity checker essentially calls solc and tries to see what errors that returns. Some times only one error is returned so that's what the solidity checker will show you. Once you fix it then more errors will be shown.

But from your report I see that there may be a problem of parsing the results of solc compile for your case.

Can you tell me what version of solc you are using and add here the .sol file you are compiling? This way I can debug it and see what's wrong.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024
$ solc --version
solc, the solidity compiler commandline interface
Version: 0.6.0+commit.26b70077.Darwin.appleclang

=> Also does it able to do style check (https://solidity.readthedocs.io/en/v0.6.0/style-guide.html) like Python does for PEP 8?

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

@avatar-lavventura I also need the solidity file that is throwing this error.

No style checks. I think the solium tool does style checks. But I have not used it myself.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

=> solium tool also does not work :(

Here is a simple example:

pragma solidity ^0.6.0;

contract Test {
    mapping(address => bytes32) public Countries;

	function get()
	external
	view
	returns (uint)
    {
     	uint a = 299;
	uint b = 150;
	uint c;
	uint c1;
	uint c2;
        uint c3;
	uint c4;
	uint c5;
        uint c6;
        uint c7;
        uint c8;
        uint c9;
        uint c10;
        uint c11;
        uint c12;
        uint c13;

	return a / b;

    }

}

Error message:

Suspicious state from syntax checker solidity-checker: Flycheck checker solidity-checker returned non-zero exit code 1, but its output contained no errors: Compiler error: Stack too deep, try removing local vari\
ables.
  --> /Users/alper/eBlocBroker/contract/contracts/flycheck_Test.sol:28:14:
   |
28 |            return a / b;
   |                   ^


Try installing a more recent version of solidity-checker, and please open a bug report if the issue persists in the latest release.  Thanks!

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

@avatar-lavventura All right I can hopefully fix this error. I tried it in my setup and it is reproducible. The error is due to changes in the way the output is done in solc versions <= 0.6.1.

The first is from solc 0.6.1 and the second from solc 0.5.7:

2020-01-13-140927_556x205_scrot

The solidity mode flychecker integration expects the output to be in the first 0.5.7 way.

Give me some time. This is something I can help you with and fix.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

Thank you @LefterisJP . There is no rush so please take your time.

=> Does solium style check works on your end? When this error is fixed, would it also let solium style checks to be work?

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

@avatar-lavventura I pushed a patch to fix this and it seems to work locally. Tell me how it is for you.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

I have deleted everything and reinstall using el-get, but seems like didn't make any change (like I am still getting the same compiler error message)

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

Also for solium I get some output like this:

tion^[[23m
^[[1m  567:2  ^[[22m   ^[[31merror  ^[[39m    Only use indent of 8 spaces.     \
                                                                               \
                                                                   ^[[3mindenta\
tion^[[23m
^[[1m  569:1  ^[[22m   ^[[31merror  ^[[39m    Only use indent of 8 spaces.     \
                                                                               \
                                                                   ^[[3mindenta\
tion^[[23m
^[[1m  569:1  ^[[22m   ^[[33mwarning  ^[[39m  Provide an error message for requ\
ire()                                                                          \
                                                                   ^[[3merror-r\
eason^[[23m
^[[1m  571:1  ^[[22m   ^[[33mwarning  ^[[39m  Line contains trailing whitespace\
                                                                               \
                                                                   ^[[3mno-trai\
ling-whitespace^[[23m
^[[1m  573:2  ^[[22m   ^[[33mwarning  ^[[39m  Line contains trailing whitespace\
                                                                               \
                                                                   ^[[3mno-trai\
ling-whitespace^[[23m
^[[1m  577:2  ^[[22m   ^[[33mwarning  ^[[39m  Line contains trailing whitespace\

Try installing a more recent version of solium-checker, and please open a bug r\
eport if the issue persists in the latest release.  Thanks!

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

Hey @avatar-lavventura for solium check please make another issue and paste your solium version and an example .sol file. Then I can look at it as a separate issue.

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

I have deleted everything and reinstall using el-get, but seems like didn't make any change (like I am still getting the same compiler error message

That's odd. It works for me. Can you go into the source file of `solidity-flycheck.el and see if it matches what is shown in latest master here? Can you make sure no remaining byte compiled files from before are left?

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

I also removed solidity-* folders under elpha.

rm -rf ~/.emacs.d/el-get/solidity-mode

Then inside emacs el-get-install => solidity-mode.

I assume it is updated, inside solidity-flycheck.el file under ~/.emacs.d/el-get/solidity-mode I can see:

. . .
defun solc-gt-0.6.0 ()
  "Return `t` if solc >= 0.6.0 and `nil` otherwise."
. . .

Can you make sure no remaining byte compiled files from before are left?

Any advice for this?

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

For example with the update version, should I receive any error for wrongly typle keywords such as:

=> uin helloWorld // t is missing
=> publi // c is missing

On my end nothing happens.

from emacs-solidity.

LefterisJP avatar LefterisJP commented on September 18, 2024

And you get absolutely nothing in the Messages buffer? It's hard for me to help since with the new version it works fine for me.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

Unfortunetly nothing shows up in the Messages buffer :-(

I only get Compiler error: Stack too deep, error if there is one right after doing saving the file.

from emacs-solidity.

avatar-lavventura avatar avatar-lavventura commented on September 18, 2024

My final setup is as follows:

(require 'flycheck)
(setq solidity-solc-path "/usr/local/bin/solc") ;; This better be set before requiring solidity mode.
(setq solidity-solium-path "/Users/alper/.npm-packages/bin//solium")

(setq solidity-flycheck-solc-checker-active t)
(setq solidity-flycheck-solium-checker-active t)

(require 'solidity-flycheck)
(require 'solidity-mode)

(setq solidity-comment-style 'slash)

(add-hook 'solidity-mode-hook
        (lambda ()
        (set (make-local-variable 'company-backends)
                (append '((company-solidity company-capf company-dabbrev-code))
                        company-backends))))

(provide 'init-solidity-mode)
(setq-default flycheck-flake8-maximum-line-length 200)

(add-hook 'c++-mode-hook 'flycheck-mode)
(add-hook 'web-mode-hook 'flycheck-mode)
(add-hook 'json-mode-hook 'flycheck-mode)
(add-hook 'solidity-mode-hook 'flycheck-mode)

from emacs-solidity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.