#!/usr/bin/env bash # # @license Apache-2.0 # # Copyright (c) 2023 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Initialize a Markdown-formatted comment body holding the annotations: comment=" # FIXME annotations " # Search for FIXME annotations in the codebase: for file in $(find bin dist docs tools etc examples lib test tools -type f); do fixmes=$(grep -E -on "FIXME:" $file) || true for fixme in $fixmes; do if [ -n "$fixme" ]; then # Since a maximum of 65,535 characters can be included in a GitHub comment body, we break out of the loop if the comment body would exceed this limit. if [ $(( ${#comment} + ${#fixme} )) -gt 65535 ]; then break fi lineNumber=$(echo $fixme | cut -d ":" -f 1) lineContent=$(awk "NR==$lineNumber" $file) lineContent=$(echo $lineContent | sed -e 's//\\-->/g') if [ ${#lineContent} -gt 80 ]; then lineContent=$(echo $lineContent | cut -c 1-80) lineContent="$lineContent..." continue fi comment="$comment - [$file#L$lineNumber](https://github.com/stdlib-js/stdlib/blob/develop/$file#L$lineNumber): $lineContent" fi done done echo "$comment"