ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.36k stars 327 forks source link

Add golang support #145

Open cbarraford opened 7 years ago

cbarraford commented 7 years ago

Fixes https://github.com/ejwa/gitinspector/pull/139

I saw the work in https://github.com/ejwa/gitinspector/pull/139 and decided to take it across the finish line.

Let me know if I did anything wrong.

adam-waldenberg commented 7 years ago

Thank you. I think this is missing support for some of the statements available in Go. From the top of my head;

return { } . if statements without paranthesis. quit defer

... and there's probably more... I'm don't use Go on a regular basis, so I don't know everything in the language.

cbarraford commented 7 years ago

@adam-waldenberg I'm not sure where to add those statements. Is there any documentation explaining how to add support for a new language?

adam-waldenberg commented 7 years ago

@CBarraford Sorry for the slow answer... Nope..there's not really any documentation... But it has been discussed previously in previous issues. Basically, metrics.py/metric_cc_tokens has entry tokens/matchstrings and exit tokens/matchstrings for each supported language or set of languages. These are just normal regular expressions.

In your changeset, ["java", "js", "c", "cc", "cpp", "go"] share one set of entry/exit tokens/matchstrings.... "go" differs slightly and adds a few things - it should probably have it's own entry in the list, much like python and csharp do.