diff --git a/metrics/raf.sh b/metrics/raf.sh index 993656b1..3316e55e 100755 --- a/metrics/raf.sh +++ b/metrics/raf.sh @@ -44,6 +44,6 @@ else raf=0 fi -echo "raf ${raf} Relative Age of File (in the entire timeframe of repository existence), - where 0.0 means the file was added in the first commit and 1.0 means that +echo "raf ${raf} Relative Age of File (in the entire timeframe of repository existence), \ + where 0.0 means the file was added in the first commit and 1.0 means that \ the file was added in the last commit" > "${output}" diff --git a/requirements.txt b/requirements.txt index 0b739da5..3260ec0c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ javalang==0.13.0 flake8==7.0.0 pylint==3.0.3 -multimetric==2.2.0 +multimetric==1.3.0 chardet==5.2.0 \ No newline at end of file diff --git a/steps/install.sh b/steps/install.sh index 7770825a..1edfe999 100755 --- a/steps/install.sh +++ b/steps/install.sh @@ -83,6 +83,15 @@ if ! jq --version >/dev/null 2>&1; then fi fi +if ! pdftotext -v >/dev/null 2>&1; then + if [ -n "${linux}" ]; then + apt-get install -y poppler + else + echo "Install 'poppler' somehow" + exit 1 + fi +fi + if ! shellcheck --version >/dev/null 2>&1; then if [ -n "${linux}" ]; then apt-get install -y shellcheck @@ -132,6 +141,7 @@ if ! pygmentize -V >/dev/null 2>&1; then fi fi +$SUDO python3 -m pip install --upgrade pip $SUDO python3 -m pip install -r "${LOCAL}/requirements.txt" gem install --no-document rubocop -v 1.56.3 diff --git a/tests/metrics/test-multimetric.sh b/tests/metrics/test-multimetric.sh index ec1204b6..1e9a0b89 100755 --- a/tests/metrics/test-multimetric.sh +++ b/tests/metrics/test-multimetric.sh @@ -50,9 +50,9 @@ EOT cat "${TARGET}/temp/multimetric.json" cat "${temp}/stdout" grep "hsd 6" "${temp}/stdout" - grep "hse 1133.218" "${temp}/stdout" - grep "hsv 188.87" "${temp}/stdout" - grep "midx 103.261" "${temp}/stdout" - grep "fout 2" "${temp}/stdout" + grep "hse 1133.21789508" "${temp}/stdout" + grep "hsv 188.86964918" "${temp}/stdout" + grep "midx 100" "${temp}/stdout" + grep "fout 0" "${temp}/stdout" } > "${stdout}" 2>&1 echo "👍🏻 Correctly counted a few metrics" diff --git a/tests/steps/test-measure-file.sh b/tests/steps/test-measure-file.sh index d15cd330..a14d02f6 100755 --- a/tests/steps/test-measure-file.sh +++ b/tests/steps/test-measure-file.sh @@ -44,8 +44,13 @@ EOT echo "${msg}" set -x test "$(echo "${msg}" | grep -c "sum=0")" = 0 - all=$(find "${temp}" -name 'm1.*' -type f -exec basename {} \;) - test "$(echo "${all}" | wc -l | xargs)" = "48" + all=$(find "${temp}" -name 'm1.*' -type f -exec basename {} \; | sort) + expected=48 + actual=$(echo "${all}" | wc -l | xargs) + if [ ! "${actual}" = "${expected}" ]; then + echo "Exactly ${expected} metrics were expected, but ${actual} were actually collected" + exit 1 + fi echo "${all}" | sort | while IFS= read -r m; do metric=${m//m\./} echo "${metric}: $(cat "${temp}/${m}")" @@ -62,9 +67,9 @@ EOT test "$(cat "${temp}/m1.notp")" = "0" test "$(cat "${temp}/m1.final")" = "0" test "$(cat "${temp}/m1.nobl")" = "1" - test "$(cat "${temp}/m1.hsd")" = "6.188" - test "$(cat "${temp}/m1.hsv")" = "122.624" - test "$(cat "${temp}/m1.hse")" = "758.735" + test "$(cat "${temp}/m1.hsd")" = "6.1875" + test "$(cat "${temp}/m1.hsv")" = "122.62388524" + test "$(cat "${temp}/m1.hse")" = "758.73528991" test "$(cat "${temp}/m1.coco")" = "0" test "$(cat "${temp}/m1.fout")" = "0" test "$(cat "${temp}/m1.LCOM5")" = "0" diff --git a/tests/steps/test-report.sh b/tests/steps/test-report.sh index c0861245..6338da24 100755 --- a/tests/steps/test-report.sh +++ b/tests/steps/test-report.sh @@ -36,6 +36,9 @@ stdout=$2 echo "\\item foo" > "${TARGET}/temp/reports/foo.tex" "${LOCAL}/steps/report.sh" test -e "${TARGET}/report.pdf" + pdftotext "${TARGET}/report.pdf" "${TARGET}/report.txt" + txt=$(cat "${TARGET}/report.txt") + echo "${txt}" | grep "yegor256/cam" } > "${stdout}" 2>&1 echo "👍🏻 A PDF report generated correctly"