1
0

Update lint to validate keymap names (#25969)

This commit is contained in:
Joel Challis
2026-02-10 16:48:09 +00:00
committed by GitHub
parent db4d8823d6
commit a170e6f191
2 changed files with 17 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
"""Functions that help you work with QMK keymaps.
"""
import sys
import re
from pathlib import Path
from subprocess import DEVNULL
@@ -239,6 +240,13 @@ def is_keymap_dir(keymap, c=True, json=True, additional_files=None):
return True
def is_valid_keymap_name(name):
"""Returns True if the given keymap name contains only valid characters.
"""
regex = re.compile(r'^[a-z0-9][a-z0-9_]+$')
return bool(regex.match(name))
def generate_json(keymap, keyboard, layout, layers, macros=None):
"""Returns a `keymap.json` for the specified keyboard, layout, and layers.