-
Notifications
You must be signed in to change notification settings - Fork 49
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
cyclomatic complexity for other languages #13
Comments
That's entirely possible. Although cyclomatic complexity is not the primary objective of a code-forensics investigation, its metrics are featured in a few analyses and sure can help to better understand the evolution of a codebase. |
True - we can use some other tools for that; |
@smontanari @jdevoo Java support to analyse complexity would be highly interesting for me. I was wondering why you have not used the whitespace / line complexity analysis instead which should be language agnosic and easier to implement. This is what Adam Tornhill suggested anyways. There is also a tool available, but I really don't know how efficent it is. |
@jeskoriesner it's always possible to add whitespace technique as an alternative, language agnostic tool. However I've never tried it myself to really tell how effective it is, and we also have the sloc analysis that can give an language neutral idea of complexity trend. Happy to look into adding java if anyone can suggest me a tool that can quickly produce a simple report and can be run from a shell command line. |
@smontanari would you have recommendations on how to write a task or one I should look at? I ask because this repo may be a starting point to incorporate Java? |
I believe that in order to understand how to produce a complexity report for code-forensics the best place to start is the report that is created to feed the diagram, i.e. a top-down approach. If you run the javascript or ruby complexity report task you will produce a report file in the temp folder. Look at the data of the report and you'll see that the intention is to produce particular metrics for each entry, each entry being, in the case of java, a class, or maybe an interface with default methods. {
path: 'path/to/file',
totalComplexity: 5.3, // number representing the aggregate cyclomatic complexity,
averageComplexity: 2.4 // number representing the average cyclomatic complexity per method/function/block,
methodComplexity: [
name: 'function/method/block identifier',
complexity: 2.1 // number representing the cyclomatic complexity of the block of code
]
} How you implement the logic to generate such data is dependent on the output of the tool you are using. Having said all that, I'm more than happy to help on the javascript/code-forensics side of things, as long as there is a command line tool that can produce meaningful data. |
Silvio, what are your thoughts on adding support for more languages? What approach would you prefer/recommend?
The text was updated successfully, but these errors were encountered: