Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip parsing g_led_config when matrix_size is missing #24739

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

zvecr
Copy link
Member

@zvecr zvecr commented Dec 22, 2024

Description

Resurrecting #23941.

While its true this error should generally not happen to valid keyboards, users are constantly tripped up by the python stack trace that is otherwise spat out. This stack trace is output even if the board is not attempting to support RGB/LED matrix.

This wall of text leads them down paths that are irrelevant to their issue. Worse is when reaching out for help, they then post the stack trace (usually as a screenshot...), and not the full output that shows the actual error that triggered matrix_size to be undefined.

Before:

make clean  handwired/zeropad:default
QMK Firmware 0.27.1
Deleting .build/ ... done.
☒ Not including data from file: keyboards/handwired/zeropad/keyboard.json
☒ 	matrix_pins: Additional properties are not allowed ('encoder' was unexpected)
☒ 'matrix_size'
Traceback (most recent call last):
  File "/home/zvecr/zv_firmware_clean/.direnv/python-3.12/lib/python3.12/site-packages/milc/milc.py", line 606, in __call__
    return self.__call__()
           ^^^^^^^^^^^^^^^
  File "/home/zvecr/zv_firmware_clean/.direnv/python-3.12/lib/python3.12/site-packages/milc/milc.py", line 611, in __call__
    return self._subcommand(self)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zvecr/zv_firmware_clean/lib/python/qmk/decorators.py", line 38, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/zvecr/zv_firmware_clean/lib/python/qmk/cli/list/layouts.py", line 21, in list_layouts
    info_data = info_json(cli.config.list_layouts.keyboard)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zvecr/zv_firmware_clean/lib/python/qmk/info.py", line 258, in info_json
    info_data = _extract_led_config(info_data, str(keyboard))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zvecr/zv_firmware_clean/lib/python/qmk/info.py", line 776, in _extract_led_config
    cols = info_data['matrix_size']['cols']
           ~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'matrix_size'
Making handwired/zeropad with keymap default

After:

$ make clean  handwired/zeropad:default
QMK Firmware 0.27.1
Deleting .build/ ... done.
☒ Not including data from file: keyboards/handwired/zeropad/keyboard.json
☒ 	matrix_pins: Additional properties are not allowed ('encoder' was unexpected)
☒ handwired/zeropad: No LAYOUTs defined! Need at least one layout defined in info.json.
Making handwired/zeropad with keymap default

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions bot added python cli qmk cli command labels Dec 22, 2024
@tzarc tzarc merged commit f549948 into qmk:master Dec 27, 2024
5 checks passed
@zvecr zvecr deleted the matrix_size_search2 branch December 29, 2024 06:53
zvecr added a commit that referenced this pull request Jan 1, 2025
@zvecr zvecr mentioned this pull request Jan 1, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli qmk cli command python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants