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

Add golang support #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ student projects in the course Object-oriented Programming Project
(TDA367/DIT211) at Chalmers University of Technology and Gothenburg University.

- Shows cumulative work by each author in the history.
- Filters results by extension (default: java,c,cpp,h,hpp,py,glsl,rb,js,sql).
- Filters results by extension (default: java,c,cpp,h,hpp,py,glsl,rb,js,sql,go).
- Can display a statistical timeline analysis.
- Scans for all filetypes (by extension) found in the repository.
- Multi-threaded; uses multiple instances of git to speed up analysis.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A full [Documentation](https://github.com/ejwa/gitinspector/wiki/Documentation)

### Some of the features
* Shows cumulative work by each author in the history.
* Filters results by extension (default: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql).
* Filters results by extension (default: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql,go).
* Can display a statistical timeline analysis.
* Scans for all filetypes (by extension) found in the repository.
* Multi-threaded; uses multiple instances of git to speed up analysis when possible.
Expand Down
2 changes: 1 addition & 1 deletion docs/gitinspector.1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Mandatory arguments to long options are mandatory for short options too\&. Boole
.PP
\fB\-f, \-\-file\-types\fR=EXTENSIONS
.RS 4
A comma separated list of file extensions to include when computing statistics\&. The default extensions used are: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql\&. Specifying a single
A comma separated list of file extensions to include when computing statistics\&. The default extensions used are: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql,go\&. Specifying a single
\fI*\fR
asterisk character includes files with no extension\&. Specifying two consecutive
\fI**\fR
Expand Down
4 changes: 2 additions & 2 deletions docs/gitinspector.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>gitinspector</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div xml:lang="en" class="refentry" lang="en"><a id="idp53245840"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>gitinspector — statistical analysis tool for git repositories</p></div><div class="refsynopsisdiv"><a id="_synopsis"></a><h2>Synopsis</h2><p><span class="strong"><strong>gitinspector</strong></span> [OPTION]… [REPOSITORY]</p></div><div class="refsect1"><a id="_description"></a><h2>DESCRIPTION</h2><p>Analyze and gather statistics about a git repository. The defaut analysis shows general statistics per author, which can be complemented with a timeline analysis that shows the workload and activity of each author. Under normal operation, gitinspector filters the results to only show statistics about a number of given extensions and by default only includes source files in the statistical analysis.</p><p>Several output formats are supported, including plain text, HTML, JSON and XML.</p></div><div class="refsect1"><a id="_options"></a><h2>OPTIONS</h2><p>List information about the repository in REPOSITORY. If no repository is specified, the current directory is used. If multiple repositories are given, information will be fetched from the last repository specified.</p><p>Mandatory arguments to long options are mandatory for short options too. Boolean arguments can only be given to long options.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>-f, --file-types</strong></span>=EXTENSIONS
</span></dt><dd>
A comma separated list of file extensions to include when computing statistics. The default extensions used are: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql. Specifying a single <span class="emphasis"><em>*</em></span> asterisk character includes files with no extension. Specifying two consecutive <span class="emphasis"><em>**</em></span> asterisk characters includes all files regardless of extension.
A comma separated list of file extensions to include when computing statistics. The default extensions used are: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql,go. Specifying a single <span class="emphasis"><em>*</em></span> asterisk character includes files with no extension. Specifying two consecutive <span class="emphasis"><em>**</em></span> asterisk characters includes all files regardless of extension.
</dd><dt><span class="term">
<span class="strong"><strong>-F, --format</strong></span>=FORMAT
</span></dt><dd>
Expand Down Expand Up @@ -102,4 +102,4 @@
</li><li class="listitem">
<span class="strong"><strong>gitinspector -x "email:.com$"</strong></span>, filter out statistics from all email addresses ending with ".com"
</li></ul></div></div><div class="refsect1"><a id="_using_git_to_configure_gitinspector"></a><h2>USING GIT TO CONFIGURE GITINSPECTOR</h2><p>Options in gitinspector can be set using <span class="strong"><strong>git config</strong></span>. Consequently, it is possible to configure gitinspector behavior globally (in all git repositories) or locally (in a specific git repository). It also means that settings will be permanently stored. All the long options that can be given to gitinspector can also be configured via git config (and take the same arguments).</p><p>To configure how gitinspector should behave in all git repositories, execute the following git command:</p><p><span class="strong"><strong>git config --global inspector.option setting</strong></span></p><p>To configure how gitinspector should behave in a specific git repository, execute the following git command (with the current directory standing inside the repository in question):</p><p><span class="strong"><strong>git config inspector.option setting</strong></span></p></div><div class="refsect1"><a id="_author"></a><h2>AUTHOR</h2><p>Originally written by Adam Waldenberg.</p></div><div class="refsect1"><a id="_reporting_bugs"></a><h2>REPORTING BUGS</h2><p>Report gitinspector bugs to <a class="ulink" href="mailto:[email protected]" target="_top">[email protected]</a></p><p>The gitinspector project page: <a class="ulink" href="https://github.com/ejwa/gitinspector" target="_top">https://github.com/ejwa/gitinspector</a></p><p>If you encounter problems, be sure to read the FAQ first: <a class="ulink" href="https://github.com/ejwa/gitinspector/wiki/FAQ" target="_top">https://github.com/ejwa/gitinspector/wiki/FAQ</a></p><p>There is also an issue tracker at: <a class="ulink" href="https://github.com/ejwa/gitinspector/issues" target="_top">https://github.com/ejwa/gitinspector/issues</a></p></div><div class="refsect1"><a id="_copyright"></a><h2>COPYRIGHT</h2><p>Copyright © 2012-2015 Ejwa Software. All rights reserved. License GPLv3+: GNU GPL version 3 or later <a class="ulink" href="http://gnu.org/licenses/gpl.html" target="_top">http://gnu.org/licenses/gpl.html</a>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.</p></div><div class="refsect1"><a id="_see_also"></a><h2>SEE ALSO</h2><p><span class="strong"><strong>git</strong></span>(1)</p></div></div></body></html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.</p></div><div class="refsect1"><a id="_see_also"></a><h2>SEE ALSO</h2><p><span class="strong"><strong>git</strong></span>(1)</p></div></div></body></html>
2 changes: 1 addition & 1 deletion docs/gitinspector.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ List information about the repository in REPOSITORY. If no repository is specifi
Mandatory arguments to long options are mandatory for short options too. Boolean arguments can only be given to long options.

*-f, --file-types*=EXTENSIONS::
A comma separated list of file extensions to include when computing statistics. The default extensions used are: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql. Specifying a single '\*' asterisk character includes files with no extension. Specifying two consecutive '**' asterisk characters includes all files regardless of extension.
A comma separated list of file extensions to include when computing statistics. The default extensions used are: java,c,cc,cpp,h,hh,hpp,py,glsl,rb,js,sql,go. Specifying a single '\*' asterisk character includes files with no extension. Specifying two consecutive '**' asterisk characters includes all files regardless of extension.

*-F, --format*=FORMAT::
Defines in which format output should be generated; the default format is 'text' and the available formats are: html,htmlembedded,json,text,xml (see <<X1,*OUTPUT FORMATS*>>)
Expand Down
6 changes: 3 additions & 3 deletions gitinspector/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
__comment_begining__ = {"java": "/*", "c": "/*", "cc": "/*", "cpp": "/*", "cs": "/*", "h": "/*", "hh": "/*", "hpp": "/*",
"hs": "{-", "html": "<!--", "php": "/*", "py": "\"\"\"", "glsl": "/*", "rb": "=begin", "js": "/*",
"jspx": "<!--", "scala": "/*", "sql": "/*", "tex": "\\begin{comment}", "xhtml": "<!--",
"xml": "<!--", "ml": "(*", "mli": "(*", "go": "/*", "ly": "%{", "ily": "%{"}
"xml": "<!--", "ml": "(*", "mli": "(*", "go": "/*", "ly": "%{", "ily": "%{", "go": "/*"}

__comment_end__ = {"java": "*/", "c": "*/", "cc": "*/", "cpp": "*/", "cs": "*/", "h": "*/", "hh": "*/", "hpp": "*/", "hs": "-}",
"html": "-->", "php": "/*", "py": "\"\"\"", "glsl": "*/", "rb": "=end", "js": "*/", "jspx": "-->",
"scala": "*/", "sql": "*/", "tex": "\\end{comment}", "xhtml": "-->", "xml": "-->", "ml": "*)", "mli": "*)",
"go": "*/", "ly": "%}", "ily": "%}"}
"go": "*/", "ly": "%}", "ily": "%}", "go": "*/"}

__comment__ = {"java": "//", "c": "//", "cc": "//", "cpp": "//", "cs": "//", "h": "//", "hh": "//", "hpp": "//", "hs": "--",
"pl": "#", "php": "//", "py": "#", "glsl": "//", "rb": "#", "robot": "#", "rs": "//", "rlib": "//", "js": "//",
"scala": "//", "sql": "--", "tex": "%", "ada": "--", "ads": "--", "adb": "--", "pot": "#", "po": "#", "go": "//",
"ly": "%", "ily": "%"}
"ly": "%", "ily": "%", "go": "//"}

__comment_markers_must_be_at_begining__ = {"tex": True}

Expand Down
2 changes: 1 addition & 1 deletion gitinspector/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from __future__ import unicode_literals

DEFAULT_EXTENSIONS = ["java", "c", "cc", "cpp", "h", "hh", "hpp", "py", "glsl", "rb", "js", "sql"]
DEFAULT_EXTENSIONS = ["java", "c", "cc", "cpp", "h", "hh", "hpp", "py", "glsl", "rb", "js", "sql", "go"]

__extensions__ = DEFAULT_EXTENSIONS
__located_extensions__ = set()
Expand Down
4 changes: 2 additions & 2 deletions gitinspector/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from . import comment, filtering, interval

__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "cs": 500, "h": 300, "hpp": 300, "php": 500, "py": 500, "glsl": 1000,
"rb": 500, "js": 500, "sql": 1000, "xml": 1000}
"rb": 500, "js": 500, "sql": 1000, "xml": 1000, "go": 500}

__metric_cc_tokens__ = [[["java", "js", "c", "cc", "cpp"], ["else", r"for\s+\(.*\)", r"if\s+\(.*\)", r"case\s+\w+:",
__metric_cc_tokens__ = [[["java", "js", "c", "cc", "cpp", "go"], ["else", r"for\s+\(.*\)", r"if\s+\(.*\)", r"case\s+\w+:",
"default:", r"while\s+\(.*\)"],
["assert", "break", "continue", "return"]],
[["cs"], ["else", r"for\s+\(.*\)", r"foreach\s+\(.*\)", r"goto\s+\w+:", r"if\s+\(.*\)", r"case\s+\w+:",
Expand Down