Skip to content

Commit f20a92d

Browse files
committed
travis/lint/radon: cumsum complexity categories, not individual scores
1 parent 544f723 commit f20a92d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.travis/check_pylint_diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PYLINT="$(command -v pylint 2>/dev/null || true)"
1717
RADON="$(command -v radon 2>/dev/null || true)"
1818
PYLINT_ARGS="--output-format=parseable"
1919
RADON_ARGS='cc --min C --no-assert --show-closures --show-complexity --average'
20+
RADON_AWK_MAP='m["A"]=1; m["B"]=1; m["C"]=2; m["D"]=3; m["E"]=5; m["F"]=8;'
2021

2122
trap "status=\$?; cd '$GIT_REPO'; rm -rf '$TMP_REPO'; exit \$status" EXIT
2223
mkdir -p "$CACHE_DIR"
@@ -139,7 +140,7 @@ Cyclomatic_complexity ()
139140
echo "$CHANGED_FILES" |
140141
xargs "$RADON" $RADON_ARGS |
141142
tee "$cached"
142-
} | awk -F'[()]' '/ .+\([0-9]+\)$/ { tot += $2 } END { print tot }' || true
143+
} | awk "BEGIN{$RADON_AWK_MAP}"'/ .+- [A-F] \(/ { tot += m[$5] } END { print tot }' || true
143144
}
144145

145146
Get_diffable ()

0 commit comments

Comments
 (0)