Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-L2L committed Jul 31, 2023
1 parent ec808a7 commit 0ff2655
Showing 1 changed file with 41 additions and 26 deletions.
67 changes: 41 additions & 26 deletions .github/workflows/comment_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on: [pull_request]

name: Comment Coverage

env:
CARGO_TERM_COLOR: always
#env:
# CARGO_TERM_COLOR: always

jobs:
check-lint-build-stable:
Expand Down Expand Up @@ -34,17 +34,23 @@ jobs:
- 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
# use a random EOF, as per GitHub security recommendations
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
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)
echo "$WARNINGS"
AWKSTR='/warning: `.+` \(lib\) generated [0-9]+ warnings?/ { print $3 ": " $7 }'
WARNINGS=$(echo "$WARNINGS" | awk -F"[\` ]" "$AWKSTR" | sort)
echo "TARGET_WARNINGS<<$EOF" >> "$GITHUB_OUTPUT"
echo "$WARNINGS" >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Checkout target branch
uses: actions/checkout@v2
Expand All @@ -54,22 +60,31 @@ 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)
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)
echo "$WARNINGS"
AWKSTR='/warning: `.+` \(lib\) generated [0-9]+ warnings?/ { print $3 ": " $7 }'
WARNINGS=$(echo "$WARNINGS" | awk -F"[\` ]" "$AWKSTR" | sort)
echo "TARGET_WARNINGS<<$EOF" >> "$GITHUB_OUTPUT"
echo "$WARNINGS" >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
- name: Compare comment coverage
run: |
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}}"
# echo "${{ steps.missing_docs_warnings_target.outputs.TARGET_WARNINGS }}"
IFS=$'\n' read -rd '' -a missing_docs_warnings_pr_arr <<< "${{steps.missing_docs_warnings_pr.outputs.TARGET_WARNINGS}}"
echo "OK 0"
IFS=$'\n' read -rd '' -a missing_docs_warnings_target_arr <<< "${{steps.missing_docs_warnings_target.outputs.TARGET_WARNINGS}}"
echo "OK 1"
for pr_warnings_line in "${missing_docs_warnings_pr_arr[@]}"
do
# Extract the libname and number of warnings from the line
Expand Down

0 comments on commit 0ff2655

Please sign in to comment.