mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Make the MSRV lint more robust
The prior version would fail if the last entry in the final array was not originally the last entry.
This commit is contained in:
14
.github/workflows/lint.yml
vendored
14
.github/workflows/lint.yml
vendored
@@ -144,14 +144,15 @@ jobs:
|
|||||||
function check_workspace {
|
function check_workspace {
|
||||||
# Get the members array from the workspace's `Cargo.toml`
|
# Get the members array from the workspace's `Cargo.toml`
|
||||||
cargo_toml_lines=$(cat ./Cargo.toml | wc -l)
|
cargo_toml_lines=$(cat ./Cargo.toml | wc -l)
|
||||||
|
# Keep all lines after the start of the array, then keep all lines before the next "]"
|
||||||
members=$(cat Cargo.toml | grep "members\ \=\ \[" -m1 -A$cargo_toml_lines | grep "]" -m1 -B$cargo_toml_lines)
|
members=$(cat Cargo.toml | grep "members\ \=\ \[" -m1 -A$cargo_toml_lines | grep "]" -m1 -B$cargo_toml_lines)
|
||||||
# Parse out any comments, including comments post-fixed on the same line as an entry
|
|
||||||
members=$(echo "$members" | grep -Ev "^[[:space:]]+#" | grep -Ev "^[[:space:]]?$" | awk -F',' '{print $1","}')
|
|
||||||
# Prune `members = [` to `[` by replacing the first line with just `[`
|
# Prune `members = [` to `[` by replacing the first line with just `[`
|
||||||
members=$(echo "$members" | sed "1s/.*/\[/")
|
members=$(echo "$members" | sed "1s/.*/\[/")
|
||||||
# Remove the trailing comma by replacing the last line's "," with ""
|
|
||||||
members=$(echo "$members" | sed "$(($(echo "$members" | wc -l) - 1))s/\,//")
|
# Parse out any comments, whitespace, including comments post-fixed on the same line as an entry
|
||||||
# Correct the last line, which was malleated to "]," when pruning comments
|
# We accomplish the latter by pruning all characters after the entry's ","
|
||||||
|
members=$(echo "$members" | grep -Ev "^[[:space:]]*(#|$)" | awk -F',' '{print $1","}')
|
||||||
|
# Correct the last line, which was malleated to "],"
|
||||||
members=$(echo "$members" | sed "$(echo "$members" | wc -l)s/\]\,/\]/")
|
members=$(echo "$members" | sed "$(echo "$members" | wc -l)s/\]\,/\]/")
|
||||||
|
|
||||||
# Don't check the patches
|
# Don't check the patches
|
||||||
@@ -174,6 +175,9 @@ jobs:
|
|||||||
members=$(echo "$members" | grep -v "mini\"")
|
members=$(echo "$members" | grep -v "mini\"")
|
||||||
members=$(echo "$members" | grep -v "tests/")
|
members=$(echo "$members" | grep -v "tests/")
|
||||||
|
|
||||||
|
# Remove the trailing comma by replacing the last line's "," with ""
|
||||||
|
members=$(echo "$members" | sed "$(($(echo "$members" | wc -l) - 1))s/\,//")
|
||||||
|
|
||||||
echo $members | jq -r ".[]" | while read -r member; do
|
echo $members | jq -r ".[]" | while read -r member; do
|
||||||
check_msrv $member
|
check_msrv $member
|
||||||
correct=$?
|
correct=$?
|
||||||
|
|||||||
Reference in New Issue
Block a user