Skip to content

Commit

Permalink
Fix hash regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Margen67 committed Oct 19, 2024
1 parent 4b5d55c commit ddfbe03
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ jobs:
}
for patch in patches/*.patch.toml; do
patch_content="$(cat "$patch")"
patch_check 'patches\/[0-9A-F]{8} - .+\.patch\.toml' "$patch" nomatch "Filename is invalid!"
patch_check 'title_name = ".+"' "$patch_content" nomatch "title_name is invalid or missing!"
patch_check 'title_id = "[0-9A-F]{8}" # [A-Z]{2}-[0-9]{4,5}' "$patch_content" nomatch "title_id is invalid or missing!"
patch_check 'hash = ("[0-9A-F]{16}" # .+|\[.*\n {4}"[0-9A-F]{16}".*(\n#? {4}"[0-9A-F]{16}".*)*\n])|#hash = (""|\[(\n# {4}"".*)+\n#])' "$patch_content" nomatch "hash is invalid or missing!"
patch_check '#hash = (""|\[\n# {4}"").*' "$patch_content" match "hash is empty."
patch_check '#media_id = ("[0-9A-F]{8}".*|\[( # .+)?\n# {4}"[0-9A-F]{8}".*(\n# {4}"[0-9A-F]{8}".*)*\n#])|#media_id = ""' "$patch_content" nomatch "media_id is invalid or missing!"
patch_check '#media_id = ""' "$patch_content" match "media_id is empty."
patch_check '\[\[patch]]' "$patch_content" nomatch "[[patch]] is missing!"
patch_check ' {4}name = ".+"' "$patch_content" nomatch "name is invalid or missing!"
patch_check ' {4}desc = ""' "$patch_content" match "Unneeded empty description!"
patch_check ' {4}author = ".+"' "$patch_content" nomatch "author is invalid or missing!"
patch_check ' {4}is_enabled = ' "$patch_content" nomatch "is_enabled is missing!"
patch_check ' {4}is_enabled = true' "$patch_content" match "Patch is enabled!"
patch_check ' {8}address = 0x[0-9a-f]{8}' "$patch_content" nomatch "address is invalid or missing!"
patch_check ' {8}value = ' "$patch_content" nomatch "value is invalid or missing!"
patch_check ' {8}address = 0x[0-9a-f]{1,15}[A-F]+' "$patch_content" match "Hex can't be uppercase!"
patch_check ' {8}value = 0x"?[0-9a-f]{1,15}[A-F]+' "$patch_content" match "Hex can't be uppercase!"
patch_check ' {4}\[\[patch\.be8]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]?$|[0-9a-f]{3,})' "$patch_content" match "value length is wrong! be8 is supposed to be 1 byte." 2
patch_check ' {4}\[\[patch\.be16]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]{0,3}$|[0-9a-f]{5,})' "$patch_content" match "value length is wrong! be16 is supposed to be 2 bytes." 2
patch_check ' {4}\[\[patch\.be32]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]{0,7}$|[0-9a-f]{9,})' "$patch_content" match "value length is wrong! be32 is supposed to be 4 bytes." 2
patch_check ' {4}\[\[patch\.be64]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]{0,15}$|[0-9a-f]{17,})' "$patch_content" match "value length is wrong! be64 is supposed to be 8 bytes." 2
patch_check 'patches\/[0-9A-F]{8} - .+\.patch\.toml' "$patch" nomatch "Filename is invalid!"
patch_check 'title_name = ".+"' "$patch_content" nomatch "title_name is invalid or missing!"
patch_check 'title_id = "[0-9A-F]{8}" # [A-Z]{2}-[0-9]{4,5}' "$patch_content" nomatch "title_id is invalid or missing!"
patch_check 'hash = ("[0-9A-F]{16}"|\[.*\n {4}"[0-9A-F]{16}",?) # .+|#hash = (""|\[(\n# {4}"".*)+\n#])' "$patch_content" nomatch "hash is invalid or missing!"
patch_check '#hash = (""|\[\n# {4}"").*' "$patch_content" match "hash is empty."
patch_check '#media_id = ("[0-9A-F]{8}".*|\[( # .+)?\n# {4}"[0-9A-F]{8}".*(\n# {4}"[0-9A-F]{8}".*)*\n#])|#media_id = ""' "$patch_content" nomatch "media_id is invalid or missing!"
patch_check '#media_id = ""' "$patch_content" match "media_id is empty."
patch_check '\[\[patch]]' "$patch_content" nomatch "[[patch]] is missing!"
patch_check ' {4}name = ".+"' "$patch_content" nomatch "name is invalid or missing!"
patch_check ' {4}desc = ""' "$patch_content" match "Unneeded empty description!"
patch_check ' {4}author = ".+"' "$patch_content" nomatch "author is invalid or missing!"
patch_check ' {4}is_enabled = ' "$patch_content" nomatch "is_enabled is missing!"
patch_check ' {4}is_enabled = true' "$patch_content" match "Patch is enabled!"
patch_check ' {8}address = 0x[0-9a-f]{8}' "$patch_content" nomatch "address is invalid or missing!"
patch_check ' {8}value = ' "$patch_content" nomatch "value is invalid or missing!"
patch_check ' {8}address = 0x[0-9a-f]{1,15}[A-F]+' "$patch_content" match "Hex can't be uppercase!"
patch_check ' {8}value = 0x"?[0-9a-f]{1,15}[A-F]+' "$patch_content" match "Hex can't be uppercase!"
patch_check ' {4}\[\[patch\.be8]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]?$|[0-9a-f]{3,})' "$patch_content" match "value length is wrong! be8 is supposed to be 1 byte." 2
patch_check ' {4}\[\[patch\.be16]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]{0,3}$|[0-9a-f]{5,})' "$patch_content" match "value length is wrong! be16 is supposed to be 2 bytes." 2
patch_check ' {4}\[\[patch\.be32]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]{0,7}$|[0-9a-f]{9,})' "$patch_content" match "value length is wrong! be32 is supposed to be 4 bytes." 2
patch_check ' {4}\[\[patch\.be64]]\n {8}address = 0x[0-9a-f]{8}\n {8}value = 0x([0-9a-f]{0,15}$|[0-9a-f]{17,})' "$patch_content" match "value length is wrong! be64 is supposed to be 8 bytes." 2
done
if [ -n "$patch_errored_fatal" ]; then
echo "Linting completed with errors!"
Expand Down

0 comments on commit ddfbe03

Please sign in to comment.