diff options
author | cbdev <cb@cbcdn.com> | 2020-03-11 21:53:14 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2020-03-11 21:53:14 +0100 |
commit | abb1ffd367f4046d77ac62b0b017b407997bc43b (patch) | |
tree | 341dd9375982db89708db30863e8cac088e2b3cc /.travis-ci.sh | |
parent | 678cc465124ad81dcec47c44cc30827e5246bd3b (diff) | |
download | midimonster-abb1ffd367f4046d77ac62b0b017b407997bc43b.tar.gz midimonster-abb1ffd367f4046d77ac62b0b017b407997bc43b.tar.bz2 midimonster-abb1ffd367f4046d77ac62b0b017b407997bc43b.zip |
Add codesmell statistics to CI
Diffstat (limited to '.travis-ci.sh')
-rw-r--r-- | .travis-ci.sh | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/.travis-ci.sh b/.travis-ci.sh index e9e3df3..763e558 100644 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -21,7 +21,7 @@ if [ "$TASK" = "spellcheck" ]; then fi # Run codespell to find some more - cs_results=$(codespell --check-filenames --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellcheck_files 2>&1) + cs_results=$(codespell --check-hidden --quiet 2 --regex "[a-zA-Z0-9][\\-'a-zA-Z0-9]+[a-zA-Z0-9]" $spellcheck_files 2>&1) cs_errors=$(wc -l <<< "$cs_results") if [ "$cs_errors" -ne 0 ]; then printf "Codespell found %s errors:\n\n" "$cs_errors" @@ -31,12 +31,40 @@ if [ "$TASK" = "spellcheck" ]; then printf "Codespell reports no errors\n" fi exit "$result" -elif [ "$TASK" = 'sanitize' ]; then +elif [ "$TASK" = "codesmell" ]; then + result=0 + + if [ -z "$(which lizard)" ]; then + printf "Installing lizard...\n" + pip3 install lizard + fi + + # Run shellcheck for all shell scripts + printf "Running shellcheck...\n" + shell_files="$(find . -type f -iname \*.sh)" + xargs shellcheck -Cnever -s bash <<< "$shell_files" + if [ "$?" -ne "0" ]; then + result=1 + fi + + # Run cloc for some stats + printf "Code statistics:\n\n" + cloc ./ + + # Run lizard for the project + printf "Running lizard for code complexity analysis\n" + lizard ./ + if [ "$?" -ne "0" ]; then + result=1 + fi + + exit "$result" +elif [ "$TASK" = "sanitize" ]; then # Run sanitized compile travis_fold start "make_sanitize" make sanitize; travis_fold end "make_sanitize" -elif [ "$TASK" = 'windows' ]; then +elif [ "$TASK" = "windows" ]; then travis_fold start "make_windows" make windows; make -C backends lua.dll |