From ddfbe03e85d292fe871fe2232dc25463ac253143 Mon Sep 17 00:00:00 2001 From: Margen67 Date: Sat, 19 Oct 2024 06:16:56 -0700 Subject: [PATCH] Fix hash regex --- .github/workflows/ci.yml | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44d8573e..2d852b4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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!"