From 4190fbf207a50d972a808a2f148fb664e2f9b9b7 Mon Sep 17 00:00:00 2001 From: Alexander Kradenkov Date: Mon, 27 Nov 2017 14:16:58 +0200 Subject: [PATCH] Add metrics specification for Swift --- gitinspector/metrics.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitinspector/metrics.py b/gitinspector/metrics.py index d213404..f4b5214 100644 --- a/gitinspector/metrics.py +++ b/gitinspector/metrics.py @@ -33,7 +33,9 @@ __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"]], + [["swift"], ["else", r"for", r"if", r"case\s+(\.?\w+(\,\s*)*)*\:", r"default\s+:", r"while"], + ["assert", "break", "continue", "defer", "return"]]] METRIC_CYCLOMATIC_COMPLEXITY_THRESHOLD = 50 METRIC_CYCLOMATIC_COMPLEXITY_DENSITY_THRESHOLD = 0.75