Skip to content
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

nSLOC does not properly count abstract/interface function lines #26

Open
IllIllI000 opened this issue Dec 23, 2024 · 0 comments
Open

nSLOC does not properly count abstract/interface function lines #26

IllIllI000 opened this issue Dec 23, 2024 · 0 comments

Comments

@IllIllI000
Copy link

// get normalized sloc (function heads normalized)
const normalized = content.replace(
/function\s*\S+\s*\([^{]*/g,
'function ',
content
);

The regex looks for a beginning curly brace, which may not exist in an interface or an abstract contract's function declaration. This can be addressed with the following change, which looks for a semicolon in addition to the opening curly brace:

-       /function\s*\S+\s*\([^{]*/g,
+       /function\s*\S+\s*\([^{;]*/g,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant