-
-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solidity: Incorrect code count from misreading valid comments #1050
Comments
Just to make it easy for the maintainer - here's my observations: Consider this: pragma solidity >=0.4.22 <0.6.0;
/*
BLAH
/*/
contract Foo {
function foo(address bar) public pure {
require(bar != address(0));
}
}
It spits out "1 code line, 8 comments" Problem is Line 4: It is having trouble deciding whether to consider the first two chars As of now, tokei does the former. Possible fix (take it w/ a grain of salt): If we know we are in the multi-line comment stack, why not aggressively "eat" characters until we find the closing? I'm sure it's not as trivial a change because languages like c++ have define macros and it shouldn't be the responsibility of tokei to know where your comment actually starts and where it ends. |
Running tokei on the solidity files in this repo returns incorrect code counts. The following example is from analyzing
src/protocol/ThunderLoan.sol
.This code snippet appears at the top of the file.
Tokei is able to count lines up until this block:
Resulting in an incorrect code count of 23 (essentially all the code lines before this comment syntax). This indicates that this particular valid solidity comment is breaking the parsing somehow. The expected count is over 100.
The text was updated successfully, but these errors were encountered: