From 9e9719e77e91546c00d9edbb1a399b872d6ec392 Mon Sep 17 00:00:00 2001 From: Sam Sendelbach Date: Tue, 19 Dec 2017 22:09:40 -0600 Subject: [PATCH] added (tentative) full golang support --- gitinspector/TMP_DELETE.py | 0 gitinspector/metrics.py | 8 ++++++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 gitinspector/TMP_DELETE.py diff --git a/gitinspector/TMP_DELETE.py b/gitinspector/TMP_DELETE.py new file mode 100644 index 0000000..e69de29 diff --git a/gitinspector/metrics.py b/gitinspector/metrics.py index 6f90ef8..8cc3588 100644 --- a/gitinspector/metrics.py +++ b/gitinspector/metrics.py @@ -24,7 +24,8 @@ from .changes import FileDiff 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} + # added eloc -- must test at 500 before opening request __metric_cc_tokens__ = [[["java", "js", "c", "cc", "cpp"], ["else", r"for\s+\(.*\)", r"if\s+\(.*\)", r"case\s+\w+:", "default:", r"while\s+\(.*\)"], @@ -33,7 +34,10 @@ __metric_cc_tokens__ = [[["java", "js", "c", "cc", "cpp"], ["else", r"for\s+\(.* "default:", r"while\s+\(.*\)"], ["assert", "break", "continue", "return"]], [["py"], [r"^\s+elif .*:$", r"^\s+else:$", r"^\s+for .*:", r"^\s+if .*:$", r"^\s+while .*:$"], - [r"^\s+assert", "break", "continue", "return"]]] + [r"^\s+assert", "break", "continue", "return"]], + [["go"], ["else", r"for\s+.*\{", r"if\s+.*\{", r"case\s+\w+:", "default:", r"goto\s+\w"], + ["break", "continue", "return"]]] + # check ast.CommClause and range statements METRIC_CYCLOMATIC_COMPLEXITY_THRESHOLD = 50 METRIC_CYCLOMATIC_COMPLEXITY_DENSITY_THRESHOLD = 0.75