Improve the check_layout CI and output
Some checks failed
Make Apk CI / Build-Apk (push) Has been cancelled
Check translations / check-translations (push) Has been cancelled
Check layouts / check_layout.output (push) Has been cancelled
Check layouts / Generated files (push) Has been cancelled

Change the format of check_layout.output to avoid adding any logs for
layouts that do not trigger any warning.

Fix the check_layout CI, which was broken since check_layout.py was
changed to take arguments.
This commit is contained in:
Jules Aguillon 2025-02-04 17:17:46 +01:00
parent ae9c2fa626
commit aaf0a9a249
4 changed files with 52 additions and 208 deletions

View File

@ -13,7 +13,7 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- run: python3 gen_layouts.py - run: python3 gen_layouts.py
- name: "Check that the generated 'layouts.xml' is uptodate, otherwise run 'python3 gen_layouts.py'" - name: "Run 'python3 gen_layouts.py' to update generated files"
run: git diff --exit-code run: git diff --exit-code
check-layouts: check-layouts:
name: check_layout.output name: check_layout.output
@ -22,5 +22,5 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v4 uses: actions/checkout@v4
- run: python3 check_layout.py - run: python3 check_layout.py
- name: "Check that the generated 'check_layout.output' is uptodate, otherwise run 'python3 check_layout.py'" - name: "Fix your layout accordingly or run 'python3 check_layout.py' to promote the warnings"
run: git diff --exit-code run: git diff --exit-code

View File

@ -134,12 +134,8 @@ tasks.register('genLayoutsList') {
tasks.register('checkKeyboardLayouts') { tasks.register('checkKeyboardLayouts') {
println "\nChecking layouts" println "\nChecking layouts"
exec { exec {
def layouts = new File(projectDir, "srcs/layouts").listFiles().findAll {
it.name.endsWith(".xml")
}
workingDir = projectDir workingDir = projectDir
commandLine("python", "check_layout.py", *layouts) commandLine("python", "check_layout.py")
standardOutput = new FileOutputStream("${projectDir}/check_layout.output")
} }
} }

View File

@ -1,191 +1,37 @@
# arab_alt arab_alt: Layout includes some ASCII punctuation but not all, missing: !, ", ', +, -, /, :, ;, <, =, >, ?, [, \, ], _, |, ~
Layout includes some ASCII punctuation but not all, missing: !, ", ', +, -, /, :, ;, <, =, >, ?, [, \, ], _, |, ~ arab_hamvaj_tly: Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], _, `, {, |, }
1 warnings arab_pc: Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, |
# arab_hamvaj_tly arab_pc_ckb: Layout includes some ASCII punctuation but not all, missing: ", %, ', +, ,, ;, <, =, >, ?, `, |, ~
Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], _, `, {, |, } arab_pc_ckb_fa: Layout includes some ASCII punctuation but not all, missing: ", #, $, %, &, ', ,, /, ;, ?, @, \, ^, `, |, ~
1 warnings arab_pc_hindu: Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, |
# arab_pc arab_pc_ir: Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], `, {, |, }
Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, | beng_national: Layout includes some ASCII punctuation but not all, missing: $
1 warnings beng_provat: Layout includes some ASCII punctuation but not all, missing: $, &, *, ., /, <, >, [, \, ], `, {, |, }
# arab_pc_ckb cyrl_yaverti: Layout includes some ASCII punctuation but not all, missing: ~
Layout includes some ASCII punctuation but not all, missing: ", %, ', +, ,, ;, <, =, >, ?, `, |, ~ cyrl_yqukeng_tj: These keys are now added automatically, unexpected: f11_placeholder, f12_placeholder
1 warnings cyrl_yxukeng_os: Layout includes some ASCII punctuation but not all, missing: ", #, $, &, ', @, [, ], ~
# arab_pc_ckb_fa cyrl_yxukeng_os: These keys are now added automatically, unexpected: f11_placeholder, f12_placeholder
Layout includes some ASCII punctuation but not all, missing: ", #, $, %, &, ', ,, /, ;, ?, @, \, ^, `, |, ~ deva_alt: Layout includes some ASCII punctuation but not all, missing: #, $, %, &, ', (, ), +, ., /, :, <, =, >, [, \, ], ^, _, `, {, |, }, ~
1 warnings deva_inscript: Duplicate keys: ।
# arab_pc_hindu deva_inscript: Layout includes some ASCII punctuation but not all, missing: ", $, ', ^, _, `, |
Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, | deva_phonetic_in: Duplicate keys: ट
1 warnings grek_qwerty: Duplicate keys: ;
# arab_pc_ir guj_phonetic_in: Duplicate keys: ટ, ડ
Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], `, {, |, } hebr_1_il: Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
1 warnings hebr_2_il: Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
# armenian_ph_am kann_kannada: Layout includes some ASCII punctuation but not all, missing: #, $, %, (, ), *, +, /, <, =, >, [, \, ], ^, `, {, |, }, ~
0 warnings latn_bepo_fr: Missing important key, missing: loc capslock
# beng_national latn_bone: Missing important key, missing: loc capslock
Layout includes some ASCII punctuation but not all, missing: $ latn_bone: Missing programming keys, missing: loc esc, loc tab
1 warnings latn_bone: Layout redefines the bottom row but some important keys are missing, missing: cursor_left, cursor_right, loc compose, loc end, loc home, loc page_down, loc page_up, loc switch_clipboard, loc switch_greekmath, loc voice_typing, switch_backward
# beng_provat latn_colemak: Some keys contain whitespaces, unexpected: ́
Layout includes some ASCII punctuation but not all, missing: $, &, *, ., /, <, >, [, \, ], `, {, |, } latn_dvorak: Missing important key, missing: loc capslock
1 warnings latn_neo2: Layout redefines the bottom row but some important keys are missing, missing: loc switch_clipboard
# cyrl_fcuzhen_mn latn_qwerty_se: Duplicate keys: !, ', ,, -, ., ?
0 warnings latn_qwerty_tly: Duplicate keys: a, c, j, q
# cyrl_jcuken_kk latn_qwerty_tly: Missing programming keys, missing: loc esc, loc tab
0 warnings latn_qwertz_cz_multifunctional: Layout includes some ASCII punctuation but not all, missing: `
# cyrl_jcuken_ru latn_qwertz_sk: Layout includes some ASCII punctuation but not all, missing: `
0 warnings urdu_phonetic_ur: Duplicate keys:
# cyrl_jcuken_uk urdu_phonetic_ur: Layout includes some ASCII punctuation but not all, missing: <, >, ?, `, |, ~
0 warnings urdu_phonetic_ur: Some keys contain whitespaces, unexpected:
# cyrl_lynyertz_sr
0 warnings
# cyrl_ueishsht
0 warnings
# cyrl_yaverti
Layout includes some ASCII punctuation but not all, missing: ~
1 warnings
# cyrl_yqukeng_tj
These keys are now added automatically, unexpected: f11_placeholder, f12_placeholder
1 warnings
# cyrl_yxukeng_os
Layout includes some ASCII punctuation but not all, missing: ", #, $, &, ', @, [, ], ~
These keys are now added automatically, unexpected: f11_placeholder, f12_placeholder
2 warnings
# deva_alt
Layout includes some ASCII punctuation but not all, missing: #, $, %, &, ', (, ), +, ., /, :, <, =, >, [, \, ], ^, _, `, {, |, }, ~
1 warnings
# deva_inscript
Duplicate keys: ।
Layout includes some ASCII punctuation but not all, missing: ", $, ', ^, _, `, |
2 warnings
# deva_phonetic_in
Duplicate keys: ट
1 warnings
# georgian_mes
0 warnings
# georgian_qwerty
0 warnings
# grek_qwerty
Duplicate keys: ;
1 warnings
# guj_phonetic_in
Duplicate keys: ટ, ડ
1 warnings
# hang_dubeolsik_kr
0 warnings
# hebr_1_il
Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
1 warnings
# hebr_2_il
Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
1 warnings
# kann_kannada
Layout includes some ASCII punctuation but not all, missing: #, $, %, (, ), *, +, /, <, =, >, [, \, ], ^, `, {, |, }, ~
1 warnings
# latn_azerty_be
0 warnings
# latn_azerty_fr
0 warnings
# latn_bepo_fr
Missing important key, missing: loc capslock
1 warnings
# latn_bone
Missing important key, missing: loc capslock
Missing programming keys, missing: loc esc, loc tab
Layout redefines the bottom row but some important keys are missing, missing: cursor_left, cursor_right, loc compose, loc end, loc home, loc page_down, loc page_up, loc switch_clipboard, loc switch_greekmath, loc voice_typing, switch_backward
3 warnings
# latn_colemak
Some keys contain whitespaces, unexpected: ́
1 warnings
# latn_dvorak
Missing important key, missing: loc capslock
1 warnings
# latn_neo2
Layout redefines the bottom row but some important keys are missing, missing: loc switch_clipboard
1 warnings
# latn_qwerty_az
0 warnings
# latn_qwerty_br
0 warnings
# latn_qwerty_cy
0 warnings
# latn_qwerty_cz
0 warnings
# latn_qwerty_da
0 warnings
# latn_qwerty_es
0 warnings
# latn_qwerty_et
0 warnings
# latn_qwerty_ga
0 warnings
# latn_qwerty_gb
0 warnings
# latn_qwerty_haw
0 warnings
# latn_qwerty_hu
0 warnings
# latn_qwerty_jp
0 warnings
# latn_qwerty_kk
0 warnings
# latn_qwerty_lt
0 warnings
# latn_qwerty_lv
0 warnings
# latn_qwerty_mt
0 warnings
# latn_qwerty_no
0 warnings
# latn_qwerty_pl
0 warnings
# latn_qwerty_ro
0 warnings
# latn_qwerty_se
Duplicate keys: !, ', ,, -, ., ?
1 warnings
# latn_qwerty_sk
0 warnings
# latn_qwerty_sr
0 warnings
# latn_qwerty_tly
Duplicate keys: a, c, j, q
Missing programming keys, missing: loc esc, loc tab
2 warnings
# latn_qwerty_tr
0 warnings
# latn_qwerty_us
0 warnings
# latn_qwerty_uz
0 warnings
# latn_qwerty_vi
0 warnings
# latn_qwertz
0 warnings
# latn_qwertz_cz
0 warnings
# latn_qwertz_cz_diacritics
0 warnings
# latn_qwertz_cz_multifunctional
Layout includes some ASCII punctuation but not all, missing: `
1 warnings
# latn_qwertz_de
0 warnings
# latn_qwertz_fr_ch
0 warnings
# latn_qwertz_hu
0 warnings
# latn_qwertz_sk
Layout includes some ASCII punctuation but not all, missing: `
1 warnings
# latn_qwertz_sq
0 warnings
# latn_workman_us
0 warnings
# shaw_imperial_en
0 warnings
# tamil_default
0 warnings
# urdu_phonetic_ur
Duplicate keys:
Layout includes some ASCII punctuation but not all, missing: <, >, ?, `, |, ~
Some keys contain whitespaces, unexpected:
3 warnings

View File

@ -1,7 +1,8 @@
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import sys, os import sys, os, glob
warning_count = 0 layout_file_name = 0
warnings = []
KNOWN_NOT_LAYOUT = set([ KNOWN_NOT_LAYOUT = set([
"number_row", "numpad", "pin", "number_row", "numpad", "pin",
@ -15,9 +16,8 @@ KEY_ATTRIBUTES = set([
]) ])
def warn(msg): def warn(msg):
global warning_count global warnings
print(msg) warnings.append("%s: %s" % (layout_file_name, msg))
warning_count += 1
def key_list_str(keys): def key_list_str(keys):
return ", ".join(sorted(list(keys))) return ", ".join(sorted(list(keys)))
@ -103,15 +103,17 @@ def check_layout(layout):
if root.get("script") == None: if root.get("script") == None:
warn("Layout doesn't specify a script.") warn("Layout doesn't specify a script.")
for fname in sorted(sys.argv[1:]): for fname in sorted(glob.glob("srcs/layouts/*.xml")):
layout_id, _ = os.path.splitext(os.path.basename(fname)) layout_id, _ = os.path.splitext(os.path.basename(fname))
if layout_id in KNOWN_NOT_LAYOUT: if layout_id in KNOWN_NOT_LAYOUT:
continue continue
layout_file_name = layout_id
layout = parse_layout(fname) layout = parse_layout(fname)
if layout == None: if layout == None:
print("Not a layout file: %s" % layout_id) warn("Not a layout file")
else: else:
print("# %s" % layout_id)
warning_count = 0
check_layout(layout) check_layout(layout)
print("%d warnings" % warning_count)
with open("check_layout.output", "w") as out:
for w in warnings:
print(w, file=out)