added (tentative) full golang support

This commit is contained in:
Sam Sendelbach 2017-12-19 22:09:40 -06:00
parent 6d77989e34
commit 9e9719e77e
2 changed files with 6 additions and 2 deletions

View file

View file

@ -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