Skip to content

Commit

Permalink
#124 reports fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 23, 2023
1 parent a684ec8 commit 2e0fca0
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,5 @@ dataset/
.idea/
Library/
test-zone/
*.zip
*.zip
*.pdf
4 changes: 2 additions & 2 deletions filters/030-delete-tests.sh
Expand Up @@ -47,8 +47,8 @@ while IFS= read -r f; do
done < "${list}"

if [ -s "${list}" ]; then
printf "There were %d files total; %d of them were test files with \\\ff{Test} or \\\ff{ITCase} suffixes and that's why they were deleted" \
"${total}" "$(wc -l < "${list}" | xargs)"
printf "%d out of %d files were tests with \\\ff{Test} or \\\ff{ITCase} suffixes and that's why they were deleted" \
"$(wc -l < "${list}" | xargs)" "${total}"
else
printf "There were no test files among %d files seen" "${total}"
fi
5 changes: 2 additions & 3 deletions filters/040-delete-unparseable.sh
Expand Up @@ -52,9 +52,8 @@ wait

total=$(wc -l < "${candidates}" | xargs)
if [ -s "${list}" ]; then
printf "There were %d files total; %d of them were Java files with broken syntax and that's why were deleted" \
"${total}" \
"$(wc -l < "${list}" | xargs)"
printf "%d out of %d files were Java files with broken syntax and that's why were deleted" \
"$(wc -l < "${list}" | xargs)" "${total}"
else
printf "There were no files with broken syntax among %d files total" \
"${total}"
Expand Down
4 changes: 2 additions & 2 deletions filters/050-delete-long-lines.sh
Expand Up @@ -50,8 +50,8 @@ done < "${candidates}"

total=$(wc -l < "${candidates}" | xargs)
if [ -s "${list}" ]; then
printf "There were %d files total; %d of them had at least one line longer than %d characters, which most probably is a symptom of an auto-generated code; that's why they all were deleted" \
"${total}" "$(wc -l < "${list}" | xargs)" "${max}"
printf "%d out of %d files had at least one line longer than %d characters, which most probably is a symptom of an auto-generated code; that's why they all were deleted" \
"$(wc -l < "${list}" | xargs)" "${total}" "${max}"
else
printf "There were no files among %d total with lines longer than %d characters" \
"${total}" "${max}"
Expand Down
7 changes: 4 additions & 3 deletions filters/060-delete-non-classes.sh
Expand Up @@ -50,10 +50,11 @@ done < "${candidates}"
"${LOCAL}/help/parallel.sh" "${jobs}"
wait

total=$(wc -l < "${candidates}" | xargs)
if [ -s "${list}" ]; then
printf "There were %d files total. %d of them were not Java classes but interfaces or enums, that's why they were deleted" \
"$(wc -l < "${candidates}" | xargs)" "$(wc -l < "${list}" | xargs)"
printf "%d out of %d files were not Java classes but interfaces or enums, that's why they were deleted" \
"$(wc -l < "${list}" | xargs)" "${total}"
else
printf "All %d files are Java classes, nothing to delete" \
"$(wc -l < "${candidates}" | xargs)"
"${total}"
fi
4 changes: 2 additions & 2 deletions filters/070-delete-invalid-files.sh
Expand Up @@ -52,8 +52,8 @@ wait

total=$(wc -l < "${candidates}" | xargs)
if [ -s "${list}" ]; then
printf "There were %s files total; %d of them had more than 1 Java class, that's why were deleted" \
"${total}" "$(wc -l < "${list}")"
printf "%d out of %d files had more than one Java class inside, that's why were deleted" \
"$(wc -l < "${list}")" "${total}"
else
if [ "${total}" -eq 0 ]; then
printf "There are no Java classes, nothing to delete"
Expand Down
5 changes: 3 additions & 2 deletions steps/report.sh
Expand Up @@ -23,7 +23,8 @@
set -e
set -o pipefail

rm -f "${TARGET}/temp/list-of-metrics.tex"
list=${TARGET}/temp/list-of-metrics.tex
rm -f "${list}"

java=${TARGET}/temp/Foo.java
mkdir -p "$(dirname "${java}")"
Expand All @@ -32,7 +33,7 @@ find "${LOCAL}/metrics" -type f -exec basename {} \; | while IFS= read -r m; do
metric=${TARGET}/temp/Foo.${m}.m
rm -f "${metric}"
"${LOCAL}/metrics/${m}" "${java}" "${metric}"
awk '{ s= "\\item\\ff{" $1 "}: "; for (i = 3; i <= NF; i++) s = s $i " "; print s; }' < "${metric}" >> "${TARGET}/temp/list-of-metrics.tex"
awk '{ s= "\\item\\ff{" $1 "}: "; for (i = 3; i <= NF; i++) s = s $i " "; print s; }' < "${metric}" >> "${list}"
echo "$(wc -l < "${metric}" | xargs) metrics from ${m}"
done

Expand Down
2 changes: 1 addition & 1 deletion tests/filters/test-040-delete-unparseable.sh
Expand Up @@ -36,7 +36,7 @@ stdout=$2
rm -f "${list}"
msg=$("${LOCAL}/filters/040-delete-unparseable.sh" "${temp}" "${temp}/temp")
echo "${msg}"
echo "${msg}" | grep "1 of them were Java files with broken syntax"
echo "${msg}" | grep "1 out of 2 files were Java files with broken syntax"
test ! -e "${java}"
test -e "${another}"
test -e "${list}"
Expand Down
2 changes: 1 addition & 1 deletion tests/filters/test-050-delete-long-lines.sh
Expand Up @@ -49,7 +49,7 @@ echo "👍🏻 A Java file with short lines wasn't deleted"
rm -f "${list}"
msg=$("${LOCAL}/filters/050-delete-long-lines.sh" "${temp}" "${temp}/temp")
echo "${msg}"
echo "${msg}" | grep "1 of them had at least one line longer than 1024 characters"
echo "${msg}" | grep "1 out of 2 files had at least one line longer than 1024 characters"
test ! -e "${java}"
test -e "${list}"
test "$(wc -l < "${list}" | xargs)" = 1
Expand Down
2 changes: 1 addition & 1 deletion tex/report.tex
Expand Up @@ -35,7 +35,7 @@
This report was generated automatically by the script, which is located in
the GitHub repository \href{https://github.com/yegor256/cam}{yegor256/cam}.

In total, \iexec{tail -n +2 "${TARGET}/repositories.csv" | wc -l}\unskip{}
In total, \iexec{tail -n +2 "${TARGET}/repositories.csv" | wc -l}\unskip{} repositories
were found and retrieved from GitHub.
\iexec{cat "${TARGET}/temp/repo-details.tex"}
The full list of them is in the \ff{repositories.csv} file.
Expand Down

0 comments on commit 2e0fca0

Please sign in to comment.