From 76f01122c2f60a51e5c2d4cdf289e5136cd50752 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 5 Aug 2023 17:58:13 +0200 Subject: [PATCH] Tweak check_layout.py - Warn about missing esc, tab, f11_placeholder and f12_placeholder. - Don't check non-layout files and special layouts. --- check_layout.output | 58 +++++++++++++++++---------------------------- check_layout.py | 14 ++++++++--- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/check_layout.output b/check_layout.output index 24b9bb7..c4dfee1 100644 --- a/check_layout.output +++ b/check_layout.output @@ -1,24 +1,28 @@ # res/xml/arab_alt.xml Layout includes some ASCII punctuation but not all, missing: !, ", ', +, -, /, :, ;, <, =, >, ?, [, \, ], _, |, ~ -1 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +2 warnings # res/xml/arab_pc_ckb.xml Layout includes some ASCII punctuation but not all, missing: ", %, ', +, ,, ., :, ;, <, =, >, ?, `, |, ~ 1 warnings # res/xml/arab_pc_ir.xml Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], `, {, |, } -1 warnings +Layout doesn't define some important keys, missing: esc, f11_placeholder, f12_placeholder, tab +2 warnings # res/xml/arab_pc.xml Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, | -1 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +2 warnings # res/xml/beng_national.xml Layout includes some ASCII punctuation but not all, missing: $ +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder Layout doesn't specify a script. -2 warnings +3 warnings # res/xml/beng_provat.xml Layout includes some ASCII punctuation but not all, missing: $, &, *, ., /, <, >, [, \, ], `, {, |, } +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder Layout doesn't specify a script. -2 warnings -Not a layout file: res/xml/bottom_row.xml +3 warnings # res/xml/cyrl_jcuken_ru.xml 0 warnings # res/xml/cyrl_jcuken_uk.xml @@ -28,15 +32,12 @@ Layout includes some ASCII punctuation but not all, missing: ~ 1 warnings # res/xml/deva_alt.xml Layout includes some ASCII punctuation but not all, missing: #, $, %, &, ', (, ), *, +, ., /, :, <, =, >, @, [, \, ], ^, _, `, {, |, }, ~ -1 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +2 warnings # res/xml/deva_inscript.xml Layout includes some ASCII punctuation but not all, missing: ", $, ', ^, _, `, | -1 warnings -# res/xml/greekmath.xml -Layout includes some ASCII punctuation but not all, missing: !, ", #, $, %, &, ', (, ), *, +, ,, -, /, :, ;, <, >, ?, @, [, \, ], _, `, {, |, }, ~ -Layout redefines the bottom row but some important keys are missing, missing: change_method, config, ctrl, switch_backward, switch_emoji, switch_forward -Layout doesn't specify a script. -3 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +2 warnings # res/xml/grek_qwerty.xml 0 warnings # res/xml/hang_dubeolsik_kr.xml @@ -77,7 +78,8 @@ Layout redefines the bottom row but some important keys are missing, missing: sw # res/xml/latn_qwerty_se.xml 0 warnings # res/xml/latn_qwerty_tr.xml -0 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +1 warnings # res/xml/latn_qwerty_us.xml 0 warnings # res/xml/latn_qwerty_vi.xml @@ -85,34 +87,18 @@ Layout includes some ASCII punctuation but not all, missing: \ 1 warnings # res/xml/latn_qwertz_cz_multifunctional.xml Layout includes some ASCII punctuation but not all, missing: ` -1 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +2 warnings # res/xml/latn_qwertz_cz.xml -0 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +1 warnings # res/xml/latn_qwertz_de.xml 0 warnings # res/xml/latn_qwertz_hu.xml 0 warnings # res/xml/latn_qwertz_sk.xml Layout includes some ASCII punctuation but not all, missing: \, ` -1 warnings +Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder +2 warnings # res/xml/latn_qwertz.xml 0 warnings -Not a layout file: res/xml/method.xml -Not a layout file: res/xml/number_row.xml -# res/xml/numeric.xml -Layout includes some ASCII punctuation but not all, missing: &, ?, @, ` -Layout redefines the bottom row but some important keys are missing, missing: change_method, config, switch_backward, switch_emoji, switch_forward, switch_numeric -Layout doesn't specify a script. -3 warnings -# res/xml/numpad.xml -Layout includes some ASCII punctuation but not all, missing: !, ", #, $, %, &, ', (, ), ,, :, ;, <, >, ?, @, [, \, ], ^, _, `, {, |, }, ~ -Layout doesn't define some important keys, missing: backspace, delete -Layout redefines the bottom row but some important keys are missing, missing: action, change_method, config, ctrl, down, enter, fn, left, right, space, switch_backward, switch_emoji, switch_forward, switch_numeric, up -Layout doesn't specify a script. -4 warnings -# res/xml/pin.xml -Layout includes some ASCII punctuation but not all, missing: !, ", $, %, &, ', ;, <, >, ?, @, [, \, ], ^, _, `, {, |, }, ~ -Layout redefines the bottom row but some important keys are missing, missing: change_method, config, ctrl, fn, switch_backward, switch_emoji, switch_forward -Layout doesn't specify a script. -3 warnings -Not a layout file: res/xml/settings.xml diff --git a/check_layout.py b/check_layout.py index d242010..e5e14dc 100644 --- a/check_layout.py +++ b/check_layout.py @@ -3,6 +3,11 @@ import sys warning_count = 0 +KNOWN_NOT_LAYOUT = set([ + "res/xml/number_row.xml", "res/xml/numpad.xml", "res/xml/pin.xml", + "res/xml/bottom_row.xml", "res/xml/settings.xml", "res/xml/method.xml", + "res/xml/greekmath.xml", "res/xml/numeric.xml" ]) + def warn(msg): global warning_count print(msg) @@ -44,9 +49,10 @@ def check_layout(layout): root, keys = layout missing_some_of(keys, "~!@#$%^&*(){}`[]=\\-_;:/.,?<>'\"+|", "ASCII punctuation") missing_some_of(keys, "0123456789", "digits") - missing_some_of(keys, ["f11_placeholder", "f12_placeholder"]) - missing_some_of(keys, ["esc", "tab"]) - missing_required(keys, ["backspace", "delete"], "Layout doesn't define some important keys") + missing_required(keys, + ["esc", "tab", "backspace", "delete", + "f11_placeholder", "f12_placeholder"], + "Layout doesn't define some important keys") unexpected_keys(keys, ["copy", "paste", "cut", "selectAll", "shareText", "pasteAsPlainText", "undo", "redo", "replaceText", @@ -74,6 +80,8 @@ def check_layout(layout): warn("Layout doesn't specify a script.") for fname in sys.argv[1:]: + if fname in KNOWN_NOT_LAYOUT: + continue layout = parse_layout(fname) if layout == None: print("Not a layout file: %s" % fname)