From 0e3ce9b339f0f5c0daa44f6a8c509ccc6e6f262a Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Thu, 6 Jun 2013 03:01:07 +0200 Subject: [PATCH] Added support for comments and metrics in PHP code. Even though it is supported, PHP is not part of the default file extensions used during analysis. To include PHP files in the statistical analysis, the extension needs to be supplied to gitinspector using the -f flag. --- comment.py | 12 ++++++------ metrics.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/comment.py b/comment.py index f5b2c4a..00744cb 100644 --- a/comment.py +++ b/comment.py @@ -17,14 +17,14 @@ # You should have received a copy of the GNU General Public License # along with gitinspector. If not, see . -__comment_begining__ = {"java": "/*", "c": "/*", "cpp": "/*", "h": "/*", "hpp": "/*", "html": "", "py": "\"\"\"", - "glsl": "*/", "rb": "=end", "js": "*/", "sql": "*/", "xml": "-->"} +__comment_end__ = {"java": "*/", "c": "*/", "cpp": "*/", "h": "*/", "hpp": "*/", "html": "-->", "php": "/*", + "py": "\"\"\"", "glsl": "*/", "rb": "=end", "js": "*/", "sql": "*/", "xml": "-->"} -__comment__ = {"java": "//", "c": "//", "cpp": "//", "h": "//", "hpp": "//", "pl": "#", "py": "#", "glsl": "//", - "rb": "#", "js": "//", "sql": "--"} +__comment__ = {"java": "//", "c": "//", "cpp": "//", "h": "//", "hpp": "//", "pl": "#", "php": "//", "py": "#", + "glsl": "//", "rb": "#", "js": "//", "sql": "--"} def is_comment(extension, string): if __comment_begining__.get(extension, None) != None and string.strip().startswith(__comment_begining__[extension]): diff --git a/metrics.py b/metrics.py index 47a1061..ea86fe2 100644 --- a/metrics.py +++ b/metrics.py @@ -27,7 +27,7 @@ import interval import missing import subprocess -__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "h": 300, "hpp": 300, "py": 500, "glsl": 1000, +__metric_eloc__ = {"java": 500, "c": 500, "cpp": 500, "h": 300, "hpp": 300, "php": 500, "py": 500, "glsl": 1000, "rb": 500, "js": 500, "sql": 1000, "xml": 1000} class MetricsLogic: