Skip to content

Commit

Permalink
Promote label with newlines to lint error (#17347)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Jun 10, 2022
1 parent d8ace62 commit 7baf9b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
5 changes: 4 additions & 1 deletion data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"label": {"type": "string"},
"label": {
"type": "string",
"pattern": "^[^\\n]*$"
},
"matrix": {
"type": "array",
"minItems": 2,
Expand Down
28 changes: 14 additions & 14 deletions keyboards/sendyyeah/75pixels/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
{"label": "I", "x": 8, "y": 1},
{"label": "O", "x": 9, "y": 1},
{"label": "P", "x": 10, "y": 1},
{"label": "|\n\\", "x": 11, "y": 1},
{"label": "7\nHome", "x": 12, "y": 1},
{"label": "8\nUp", "x": 13, "y": 1},
{"label": "9\nPgUp", "x": 14, "y": 1},
{"label": "|", "x": 11, "y": 1},
{"label": "7", "x": 12, "y": 1},
{"label": "8", "x": 13, "y": 1},
{"label": "9", "x": 14, "y": 1},
{"label": "Caps", "x": 0, "y": 2},
{"label": "A", "x": 1, "y": 2},
{"label": "S", "x": 2, "y": 2},
Expand All @@ -47,9 +47,9 @@
{"label": "L", "x": 9, "y": 2},
{"label": ":", "x": 10, "y": 2},
{"label": "Enter", "x": 11, "y": 2},
{"label": "4\nLeft", "x": 12, "y": 2},
{"label": "4", "x": 12, "y": 2},
{"label": "5", "x": 13, "y": 2},
{"label": "6\nRight", "x": 14, "y": 2},
{"label": "6", "x": 14, "y": 2},
{"label": "Shift", "x": 0, "y": 3},
{"label": "Z", "x": 1, "y": 3},
{"label": "X", "x": 2, "y": 3},
Expand All @@ -58,13 +58,13 @@
{"label": "B", "x": 5, "y": 3},
{"label": "N", "x": 6, "y": 3},
{"label": "M", "x": 7, "y": 3},
{"label": "<\n,", "x": 8, "y": 3},
{"label": ">\n.", "x": 9, "y": 3},
{"label": "?\n/", "x": 10, "y": 3},
{"label": "<", "x": 8, "y": 3},
{"label": ">", "x": 9, "y": 3},
{"label": "?", "x": 10, "y": 3},
{"label": "Shift", "x": 11, "y": 3},
{"label": "1\nEnd", "x": 12, "y": 3},
{"label": "2\nDown", "x": 13, "y": 3},
{"label": "3\nPgDn", "x": 14, "y": 3},
{"label": "1", "x": 12, "y": 3},
{"label": "2", "x": 13, "y": 3},
{"label": "3", "x": 14, "y": 3},
{"label": "Ctrl", "x": 0, "y": 4},
{"label": "Win", "x": 1, "y": 4},
{"label": "Alt", "x": 2, "y": 4},
Expand All @@ -77,8 +77,8 @@
{"label": "Win", "x": 9, "y": 4},
{"label": "Menu", "x": 10, "y": 4},
{"label": "Ctrl", "x": 11, "y": 4},
{"label": "0\nIns", "x": 12, "y": 4},
{"label": ".\nDel", "x": 13, "y": 4},
{"label": "0", "x": 12, "y": 4},
{"label": ".", "x": 13, "y": 4},
{"label": "Enter", "x": 14, "y": 4}
]
}
Expand Down
10 changes: 0 additions & 10 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ def _valid_community_layout(layout):
return (Path('layouts/default') / layout).exists()


def _remove_newlines_from_labels(layouts):
for layout_name, layout_json in layouts.items():
for key in layout_json['layout']:
if '\n' in key['label']:
key['label'] = key['label'].split('\n')[0]


def info_json(keyboard):
"""Generate the info.json data for a specific keyboard.
"""
Expand Down Expand Up @@ -111,9 +104,6 @@ def info_json(keyboard):
# Check that the reported matrix size is consistent with the actual matrix size
_check_matrix(info_data)

# Remove newline characters from layout labels
_remove_newlines_from_labels(layouts)

return info_data


Expand Down

0 comments on commit 7baf9b3

Please sign in to comment.