-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With the release of 2.3.0-rc, we know that 2.3.0 will be coming sometime soon. Per the [ZFS release policy][1], only the current and previous releases are expected to be supported, so 2.1.x will become unsupported. Unfortunately upstream does not have any specific timelines, so we do not know when it will become unsupported, but when it does we will likely backport the removal. As such, begin warning of imminent removal. [1]: https://github.com/openzfs/zfs/blob/6187b194349c5a728c9df8c6842f1866d5c9782a/RELEASES.md
- Loading branch information
Showing
4 changed files
with
85 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Filtering error messages we don't like | ||
nixf_wrapper(){ | ||
nixf-tidy --variable-lookup < "$1" | jq -r ' | ||
[ | ||
"sema-escaping-with" | ||
] | ||
as $ignored_errors|[.[]|select(.sname as $s|$ignored_errors|index($s)|not)] | ||
' | ||
} | ||
|
||
failedFiles=() | ||
|
||
# Don't report errors to file overview | ||
# to avoid duplicates when editing title and description | ||
if [[ "______" ]]; then | ||
DONT_REPORT_ERROR=1 | ||
else | ||
DONT_REPORT_ERROR= | ||
fi | ||
# TODO: Make this more parallel | ||
|
||
# Loop through all Nix files touched by the PR | ||
while readarray -d '' -n 2 entry && (( ${#entry[@]} != 0 )); do | ||
type=${entry[0]} | ||
file=${entry[1]} | ||
case $type in | ||
A*) | ||
source="" | ||
dest=$file | ||
;; | ||
M*) | ||
source=$file | ||
dest=$file | ||
;; | ||
C*|R*) | ||
source=$file | ||
read -r -d '' dest | ||
;; | ||
*) | ||
echo "Ignoring file $file with type $type" | ||
continue | ||
esac | ||
|
||
if [[ -n "$source" ]] && [[ "$(nixf_wrapper ______/"$source")" != '[]' ]] 2>/dev/null; then | ||
echo "Ignoring file $file because it doesn't pass nixf-tidy in the base commit" | ||
echo # insert blank line | ||
else | ||
nixf_report="$(nixf_wrapper "$dest")" | ||
if [[ "$nixf_report" != '[]' ]]; then | ||
echo "$dest doesn't pass nixf-tidy. Reported by nixf-tidy:" | ||
errors=$(echo "$nixf_report" | jq -r --arg dest "$dest" ' | ||
def getLCur: "line=" + (.line+1|tostring) + ",col=" + (.column|tostring); | ||
def getRCur: "endLine=" + (.line+1|tostring) + ",endColumn=" + (.column|tostring); | ||
def getRange: "file=\($dest)," + (.lCur|getLCur) + "," + (.rCur|getRCur); | ||
def getBody: . as $top|(.range|getRange) + ",title="+ .sname + "::" + | ||
(.message|sub("{}" ; ($top.args.[]|tostring))); | ||
def getNote: "\n::notice " + (.|getBody); | ||
def getMessage: "::error " + (.|getBody) + (if (.notes|length)>0 then | ||
([.notes.[]|getNote]|add) else "" end); | ||
.[]|getMessage | ||
') | ||
if [[ -z "$DONT_REPORT_ERROR" ]]; then | ||
echo "$errors" | ||
else | ||
# just print in plain text | ||
echo "$errors" | sed 's/^:://' | ||
echo # add one empty line | ||
fi | ||
failedFiles+=("$dest") | ||
fi | ||
fi | ||
done < <(git diff -z --name-status ______ -- '*.nix') | ||
|
||
if [[ -n "$DONT_REPORT_ERROR" ]]; then | ||
echo "Edited the PR but didn't change the base branch, only the description/title." | ||
echo "Not reporting errors again to avoid duplication." | ||
echo # add one empty line | ||
fi | ||
|
||
if (( "${#failedFiles[@]}" > 0 )); then | ||
echo "Some new/changed Nix files don't pass nixf-tidy." | ||
echo "See ______/files for reported errors." | ||
echo "If you believe this is a false positive, ping @Aleksanaa and @inclyc in this PR." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters