Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
leanprover-community-mathlib4-bot committed Jan 30, 2025
2 parents de263af + 956d514 commit 67ed86a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "9cac4053a414bac9ebc0f19f20299ba3454e7a18",
"rev": "2d82a7a4777605ccc9a381b8dbe6a84e95da07b3",
"name": "batteries",
"manifestFile": "lake-manifest.json",
"inputRev": "vector-lawfulEq",
Expand Down
11 changes: 8 additions & 3 deletions scripts/technical-debt-metrics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ computeDiff () {
# The script uses the fact that a line represents a technical debt if and only if the text before
# the first `|` is a number. This is then used for comparison and formatting.
tdc () {
# We perform word-splitting "by hand" in the "middle" entries.
# See also the comment on the `read` line in the for-loop that follows the definition of this array.
titlesPathsAndRegexes=(
"porting notes" "*" "Porting note"
"backwards compatibility flags" "*" "set_option.*backward"
"skipAssignedInstances flags" "*" "set_option tactic.skipAssignedInstances"
"adaptation notes" ":^Mathlib/Tactic/AdaptationNote.lean" "^[· ]*#adaptation_note"
"adaptation notes" ":^Mathlib/Tactic/AdaptationNote.lean :^Mathlib/Tactic/Linter"
"^[· ]*#adaptation_note"
"disabled simpNF lints" "*" "nolint simpNF"
"erw" "*" "erw \["
"maxHeartBeats modifications" ":^MathlibTest" "^ *set_option .*maxHeartbeats"
Expand All @@ -87,13 +90,15 @@ for i in ${!titlesPathsAndRegexes[@]}; do
# loop on every 3rd entry and name that entry and the following two
if (( i % 3 == 0 )); then
title="${titlesPathsAndRegexes[$i]}"
pathspec="${titlesPathsAndRegexes[$(( i + 1 ))]}"
# Here we perform word-splitting: `pathspec` is an array whose entries are the "words" in
# the string `"${titlesPathsAndRegexes[$(( i + 1 ))]}"`.
read -r -a pathspec <<< "${titlesPathsAndRegexes[$(( i + 1 ))]}"
regex="${titlesPathsAndRegexes[$(( i + 2 ))]}"
if [ "${title}" == "porting notes" ]
then fl="-i" # just for porting notes we ignore the case in the regex
else fl="--"
fi
printf '%s|%s\n' "$(git grep "${fl}" "${regex}" -- ":^scripts" "${pathspec}" | wc -l)" "${title}"
printf '%s|%s\n' "$(git grep "${fl}" "${regex}" -- ":^scripts" "${pathspec[@]}" | wc -l)" "${title}"
fi
done

Expand Down

0 comments on commit 67ed86a

Please sign in to comment.