diff --git a/metrics/ast.py b/metrics/ast.py index f4bab150..3012fa3e 100755 --- a/metrics/ast.py +++ b/metrics/ast.py @@ -418,7 +418,7 @@ class NotClassError(Exception): amount of parameters in some static method in a class\n') metric.write(f'nom {nom(tree_class)} ' f'Number of Overriding Methods (NOM), which is the number of methods \ - with the \\text{{@Override}} annotation\n') + with the \\texttt{{@Override}} annotation\n') metric.write(f'nop {nop(tree_class)} ' f'Number of Polymorphic Methods (NOP), which is the count of methods \ that are overloaded at least once --- have similar names but different parameters\n') diff --git a/metrics/multimetric.sh b/metrics/multimetric.sh index d808d670..c98b565e 100755 --- a/metrics/multimetric.sh +++ b/metrics/multimetric.sh @@ -33,9 +33,9 @@ temp="${TARGET}/temp/multimetric.json" mkdir -p "$(dirname "${temp}")" echo "${body}" > "${temp}" cat < "${output}" -hsd $(echo "${body}" | jq '.halstead_difficulty' | "${LOCAL}/help/float.sh") Halstead Difficulty -hse $(echo "${body}" | jq '.halstead_effort' | "${LOCAL}/help/float.sh") Halstead Effort -hsv $(echo "${body}" | jq '.halstead_volume' | "${LOCAL}/help/float.sh") Halstead Volume -midx $(echo "${body}" | jq '.maintainability_index' | "${LOCAL}/help/float.sh") Maintainability Index -fout $(echo "${body}" | jq '.fanout_external' | "${LOCAL}/help/float.sh") Fan-Out +hsd $(echo "${body}" | jq '.halstead_difficulty' | "${LOCAL}/help/float.sh") \href{https://en.wikipedia.org/wiki/Halstead_complexity_measures}{Halstead Difficulty} +hse $(echo "${body}" | jq '.halstead_effort' | "${LOCAL}/help/float.sh") \href{https://en.wikipedia.org/wiki/Halstead_complexity_measures}{Halstead Effort} +hsv $(echo "${body}" | jq '.halstead_volume' | "${LOCAL}/help/float.sh") \href{https://en.wikipedia.org/wiki/Halstead_complexity_measures}{Halstead Volume} +midx $(echo "${body}" | jq '.maintainability_index' | "${LOCAL}/help/float.sh") \href{https://ieeexplore.ieee.org/abstract/document/303623/}{Maintainability Index} +fout $(echo "${body}" | jq '.fanout_external' | "${LOCAL}/help/float.sh") \href{https://en.wikipedia.org/wiki/Fan-out_(software)}{Fan-Out} EOT diff --git a/metrics/pmd.sh b/metrics/pmd.sh index e327f50a..7f1df7f2 100755 --- a/metrics/pmd.sh +++ b/metrics/pmd.sh @@ -50,18 +50,19 @@ export PMD_JAVA_OPTS=${JVM_OPTS} # We don't use --cache here, because it becomes too big and leads to "Out Of Memory" error pmd pmd -R "${tmp}/config.xml" -d "${tmp}" --format xml --fail-on-violation false > "${tmp}/result.xml" 2> "${tmp}/stderr.txt" || (cat "${tmp}/stderr.txt"; exit 1) +tail='\\href{https://en.wikipedia.org/wiki/Cognitive_complexity}{Cognitive Complexity} values for all methods in a class' sed 's/xmlns=".*"//g' "${tmp}/result.xml" | \ (xmllint --xpath '//violation[@rule="CognitiveComplexity"]/text()' - 2>/dev/null || echo '') | \ sed -E "s/.*complexity of ([0-9]+).*/\1/" | \ sed '/^[[:space:]]*$/d' | \ - ruby -e ' - a = STDIN.read.split(" ").map(&:to_i) + ruby -e " + a = STDIN.read.split(' ').map(&:to_i) sum = a.inject(&:+) - puts "coco #{a.empty? ? 0 : sum} Total Cognitive Complexity of All Methods" - puts "acoco #{a.empty? ? 0 : sum / a.count} Average Cognitive Complexity of a Method" - puts "mxcoco #{a.empty? ? 0 : a.max} Max Cognitive Complexity of a Method" - puts "mncoco #{a.empty? ? 0 : a.min} Min Cognitive Complexity of a Method" - ' > "${output}" + puts \"coco #{a.empty? ? 0 : sum} Summary of ${tail}\" + puts \"acoco #{a.empty? ? 0 : sum / a.count} Average of ${tail}\" + puts \"mxcoco #{a.empty? ? 0 : a.max} Maximum ${tail}\" + puts \"mncoco #{a.empty? ? 0 : a.min} Minimum ${tail}\" + " > "${output}" rm -rf "${tmp}" diff --git a/steps/tests.sh b/steps/tests.sh index f50805ab..14c84279 100755 --- a/steps/tests.sh +++ b/steps/tests.sh @@ -28,9 +28,13 @@ mkdir -p "${temp}" export CAMTESTS=1 -find "${LOCAL}/tests" -type f -name '*.sh' | sort | while IFS= read -r test; do +dir="${LOCAL}/tests" +tests=$(find "${dir}" -type f -name '*.sh' | sort) +echo "There are $(echo "${tests}" | wc -l | xargs) tests in ${dir}" +echo "${tests}" | while IFS= read -r test; do name=$(realpath --relative-to="${LOCAL}/tests" "${test}") if [ -n "${TEST}" ] && [ ! "${TEST}" = "${name}" ] && [ ! "${TEST}" = "tests/${name}" ]; then + echo "Skipped ${name}" continue fi echo -e "\n${name}:"