Commit 95cf06ba authored by clabby's avatar clabby

Default to public issues

parent 91a98580
......@@ -15,7 +15,7 @@ fi
# Default org and repo
ORG="ethereum-optimism"
REPO="client-pod"
REPO="optimism"
# Counter for issues that were not found and issues that are still open.
NOT_FOUND_COUNT=0
......@@ -49,19 +49,37 @@ for arg in "$@"; do
esac
done
# Use ripgrep to search for the pattern in all files within the repo
todos=$(rg -o --with-filename -n -g '!ops/scripts/todo-checker.sh' 'TODO\(([^)]+)\): [^,;]*')
spinner() {
local pid=$1
local delay=0.05
local spinstr='|/-\'
echo -n "Loading TODOs... "
while [ "$(ps a | awk '{print $1}' | rg $pid)" ]; do
local temp=${spinstr#?}
printf " [${GREEN}%c${NC}] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
}
{
# Use ripgrep to search for the pattern in all files within the repo
todos=$(rg -o --with-filename -n -g '!ops/scripts/todo-checker.sh' 'TODO\(([^)]+)\): [^,;]*')
# Check each TODO comment in the repo
IFS=$'\n' # Set Internal Field Separator to newline for iteration
for todo in $todos; do
# Print a newline
echo ""
# Check each TODO comment in the repo
IFS=$'\n' # Set Internal Field Separator to newline for iteration
for todo in $todos; do
# Extract the text inside the parenthesis
FILE=$(echo $todo | awk -F':' '{print $1}')
LINE_NUM=$(echo $todo | awk -F':' '{print $2}')
ISSUE_REFERENCE=$(echo $todo | sed -n 's/.*TODO(\([^)]*\)).*/\1/p')
# Parse the format of the TODO comment. There are 3 supported formats:
# * TODO(<issue_number>): <description> (Default org & repo: "ethereum-optimism/client-pod")
# * TODO(<issue_number>): <description> (Default org & repo: "ethereum-optimism/monorepo")
# * TODO(repo#<issue_number>): <description> (Default org "ethereum-optimism")
# * TODO(org/repo#<issue_number>): <description>
#
......@@ -112,16 +130,16 @@ for todo in $todos; do
((OPEN_COUNT++))
TITLE=$(echo "$RESPONSE" | jq -r .title)
OPEN_ISSUES+=("$REPO_FULL/issues/$ISSUE_NUM|$TITLE|$FILE:$LINE_NUM")
done
done
# Print summary
if [[ $NOT_FOUND_COUNT -gt 0 ]]; then
# Print summary
if [[ $NOT_FOUND_COUNT -gt 0 ]]; then
echo -e "${YELLOW}[Warning]:${NC} ${CYAN}$NOT_FOUND_COUNT${NC} TODOs referred to issues that were not found."
fi
if [[ $MISMATCH_COUNT -gt 0 ]]; then
fi
if [[ $MISMATCH_COUNT -gt 0 ]]; then
echo -e "${YELLOW}[Warning]:${NC} ${CYAN}$MISMATCH_COUNT${NC} TODOs did not match the expected pattern. Run with ${RED}\`--verbose\`${NC} to show details."
fi
if [[ $OPEN_COUNT -gt 0 ]]; then
fi
if [[ $OPEN_COUNT -gt 0 ]]; then
echo -e "${GREEN}[Info]:${NC} ${CYAN}$OPEN_COUNT${NC} TODOs refer to issues that are still open."
echo -e "${GREEN}[Info]:${NC} Open issue details:"
printf "\n${PURPLE}%-50s${NC} ${GREY}|${NC} ${GREEN}%-55s${NC} ${GREY}|${NC} ${YELLOW}%-30s${NC}\n" "Repository & Issue" "Title" "Location"
......@@ -145,4 +163,14 @@ if [[ $OPEN_COUNT -gt 0 ]]; then
printf "${CYAN}%-50s${NC} ${GREY}|${NC} %-55s ${GREY}|${NC} ${YELLOW}%-30s${NC}\n" "$REPO_ISSUE" "$TITLE" "$LOC"
done
fi
fi
} &
# Save the Process ID of the job you started in the background
PID=$!
# Start the spinner with the background job's Process ID
spinner $PID
# Wait for the background job to finish
wait $PID
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment