From 7438a02ec701df2d033229c2930f97d48c0a3b2e Mon Sep 17 00:00:00 2001 From: Ash Manning Date: Fri, 28 Jul 2023 03:02:46 +0800 Subject: [PATCH] WIP --- .github/workflows/comment_coverage.yaml | 85 +++++++++++++++++-------- 1 file changed, 60 insertions(+), 25 deletions(-) diff --git a/.github/workflows/comment_coverage.yaml b/.github/workflows/comment_coverage.yaml index b92b56f..270a4a9 100644 --- a/.github/workflows/comment_coverage.yaml +++ b/.github/workflows/comment_coverage.yaml @@ -31,20 +31,21 @@ jobs: - name: Checkout PR branch uses: actions/checkout@v2 - - name: Missing docs warnings (PR) - id: missing_docs_warnings_pr - run: | - cargo -q clippy --message-format=short -- \ - -Aclippy::all \ - -Wclippy::missing_errors_doc \ - -Wclippy::missing_panics_doc \ - -Wclippy::missing_safety_doc \ - -Wclippy::missing_docs_in_private_items \ - -Wmissing_docs \ - 2>&1 \ - | awk -F"[\` ]" \ - '/warning: `.+?` \(lib\) generated [0-9]+ warning[s]?/ { print $3 ": " $7 }' \ - | sort + #- name: Missing docs warnings (PR) + # id: missing_docs_warnings_pr + # run: | + # cargo -q clippy --message-format=short -- \ + # -Aclippy::all \ + # -Wclippy::missing_errors_doc \ + # -Wclippy::missing_panics_doc \ + # -Wclippy::missing_safety_doc \ + # -Wclippy::missing_docs_in_private_items \ + # -Wmissing_docs \ + # 2>&1 \ + # | awk -F"[\` ]" \ + # '/warning: `.+?` \(lib\) generated [0-9]+ warning[s]?/ { print $3 ": " $7 }' \ + # | sort \ + # | echo - name: Checkout target branch uses: actions/checkout@v2 @@ -54,20 +55,54 @@ jobs: - name: Missing docs warnings (Target) id: missing_docs_warnings_target run: | - cargo -q clippy --message-format=short -- \ - -Aclippy::all \ - -Wclippy::missing_errors_doc \ - -Wclippy::missing_panics_doc \ - -Wclippy::missing_safety_doc \ - -Wclippy::missing_docs_in_private_items \ - -Wmissing_docs \ - 2>&1 \ - | awk -F"[\` ]" \ - '/warning: `.+?` \(lib\) generated [0-9]+ warning[s]?/ { print $3 ": " $7 }' \ - | sort + # use a random EOF, as per GitHub security recommendations + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + WARNINGS0=$(\ + cargo -q clippy --message-format=short -- \ + -Aclippy::all \ + -Wclippy::missing_errors_doc \ + -Wclippy::missing_panics_doc \ + -Wclippy::missing_safety_doc \ + -Wclippy::missing_docs_in_private_items \ + -Wmissing_docs \ + 2>&1) + # check that $0 is not getting a previous command output + ABCDEF="ABCDEF" + AWKSTR='{ print $0 }' + WARNINGS1=$(echo "$WARNINGS0" | awk "$AWKSTR") + #WARNINGS="$(\ + # cargo -q clippy --message-format=short -- \ + # -Aclippy::all \ + # -Wclippy::missing_errors_doc \ + # -Wclippy::missing_panics_doc \ + # -Wclippy::missing_safety_doc \ + # -Wclippy::missing_docs_in_private_items \ + # -Wmissing_docs \ + # 2>&1 \ + # | awk -F"[\` ]" \ + # '/warning: `.+` \(lib\) generated [0-9]+ warnings?/ { print $3 ": " $7 }' \ + # | sort)" + #echo "TARGET_WARNINGS<<$EOF" >> "$GITHUB_OUTPUT" + #echo "$WARNINGS" >> "$GITHUB_OUTPUT" + #echo "$EOF" >> "$GITHUB_OUTPUT" + #echo "abc" + #echo "${WARNINGS}" + #echo "$WARNINGS" + #WARNINGS="ABCDEF" + #echo "${WARNINGS}" + #echo "$WARNINGS" + echo "${WARNINGS0}" + echo "$AWKSTR" + echo "${WARNINGS1}" + echo "0000" + echo "$WARNINGS0" | awk "${AWKSTR}" - name: Compare comment coverage run: | + echo "test abc" + echo "${{ env.target_warnings }}" + echo "${{ env.TARGET_WARNINGS }}" + echo "${{ steps.missing_docs_warnings_target.outputs.TARGET_WARNINGS }}" IFS=$'\n' read -rd '' -a missing_docs_warnings_pr_arr <<< "${{steps.missing_docs_warnings_pr.outcome}}" IFS=$'\n' read -rd '' -a missing_docs_warnings_target_arr <<< "${{steps.missing_docs_warnings_target.outcome}}" for pr_warnings_line in "${missing_docs_warnings_pr_arr[@]}"