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

Is it possible to get the cyclomatic complexity value as an output? #48

Closed
avinashmaheshjoshi opened this issue Jun 29, 2018 · 5 comments

Comments

@avinashmaheshjoshi
Copy link

Hi, I wish to calculate the cyclomatic complexity score for the contracts I'll be using. Is it possible to get that value?

As I understand, here we are just checking with a "max" number?

@hiqua
Copy link

hiqua commented Jul 5, 2018

If you use:

{
  "rules": {
    "code-complexity": ["warn", 0.5]
  }
}

then at least you will obtain the complexities for all the functions. You would have to parse the output to compute a proper report from this.

@mgarciap
Copy link
Contributor

mgarciap commented Jul 6, 2018

I think it should be considered to be built into the linter. The team will take a look at it.
BTW, pls feel free to contribute with your PRs

@fvictorio
Copy link
Contributor

Hello @avinashmaheshjoshi. There's no way right now to do this, except using the workaround that @hiqua mentioned. And since solhint is a linter, I don't think this feature would make sense. Either something is a warning or an error, or it isn't.

It would be nice to have a different tool to do this, though. The code that does this is not too complex. Look at lib/rules/best-practises/code-complexity if you want to give it a shot.

@hiqua
Copy link

hiqua commented Jul 16, 2018

One could argue that it still belongs there, as part of a general report about the code quality, cf pylint as an example of a linter that goes a bit beyond warnings or errors (e.g. it can grade Python code).

@fvictorio
Copy link
Contributor

Closing this since we probably won't do this.

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

4 participants