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

Question: Is the McCabe cyclomatic complexity measure on the roadmap? #237

Closed
trpapp opened this Issue Jun 20, 2018 · 9 comments

Comments

3 participants
@trpapp
Copy link

trpapp commented Jun 20, 2018

I'm looking for solutions regarding statistics and metrics. I came across the metrics package in the python community (at: https://pypi.org/project/metrics/). They have a McCabe score which measures cyclomatic complexity (ie - how complex your code is). I was wondering if you had something similar on the roadmap? Thanks!

@trpapp trpapp changed the title Is the McCabe cyclomatic complexity measure on the roadmap? Question: Is the McCabe cyclomatic complexity measure on the roadmap? Jun 20, 2018

@Aaronepower

This comment has been minimized.

Copy link
Owner

Aaronepower commented Jul 4, 2018

Thank you for this issue! I have no plans to implement such a feature as it requires a more extensive knowledge of the programming languages that is out of scope for tokei.

@Aaronepower Aaronepower closed this Jul 4, 2018

@boyter

This comment has been minimized.

Copy link

boyter commented Jul 8, 2018

@trpapp Its not using that score but have a look at scc which does have a crude but effective complexity calculation in it https://github.com/boyter/scc/

@trpapp

This comment has been minimized.

Copy link

trpapp commented Jul 9, 2018

Wow thanks! Great looking project!
@boyter

@trpapp

This comment has been minimized.

Copy link

trpapp commented Jul 9, 2018

You have estimates for development cost, schedule effort AND people required!? Superb!
@boyter

@boyter

This comment has been minimized.

Copy link

boyter commented Jul 9, 2018

@trpapp Indeed. Using the COCOMO model although it might not be correct, but seems to be inline with what SLOCCount produces.

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 29, 2018

I found scc measures of complexity quite good on average, maybe next stop for @boyter learning rust to contribute back? 😄

https://boyter.org/posts/reading-files-quickly-in-rust/

However with the latest release of 1.27 of Rust (SIMD support) the code counters written in Rust were suddenly a lot faster in Linux. In fact it meant that the fastest one tokei was suddenly faster than my scc for almost all tests.

Seeing as I wanted to learn Rust anyway it seemed like a good idea to attempt to port scc into Rust, and learn if scc would have been faster if so.

maybe reword to:

Seeing as I wanted to learn Rust anyway it seemed like a good idea to attempt to port back some of scc into tokei, and learn.

?

@boyter

This comment has been minimized.

Copy link

boyter commented Aug 29, 2018

@monouser7dig I am actually looking at scc again now that Go 1.11 has been released. I have cleaned up a lot of the issues with accuracy so it should be on par with tokei except for nested comments (which I didn't know was a thing) which I am working on now. I want to bring it totally into line.

Part of that however is that I get new profiling tools with Go 1.11 which have allowed me for example to already speed up the complexity calculation, which now is almost done for free.

$ hyperfine 'scc' && hyperfine 'scc -c'
Benchmark #1: scc
  Time (mean ± σ):      75.0 ms ±   5.4 ms    [User: 46.4 ms, System: 148.7 ms]
  Range (min … max):    60.1 ms …  86.8 ms

Benchmark #1: scc -c
  Time (mean ± σ):      74.3 ms ±   5.0 ms    [User: 39.5 ms, System: 148.9 ms]
  Range (min … max):    66.2 ms …  86.3 ms

Once I have that released I will be looking at Rust again. My long term goal is to be able to contribute to projects such as tokei but I am far from being able to do that. I just don't have the skill. Maybe in 6 months to a years time.

Glad to hear you find the complexity calculation useful though! Its the one thing I thought was always missing from these tools, hence adding it.

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 29, 2018

Okay, great news, looking forward to reading about your findings 👍

@boyter

This comment has been minimized.

Copy link

boyter commented Aug 29, 2018

Will be doing the usual blog treatment when I do. Will appear on boyter.org in sometime in the next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment