diff options
| author | Ryan <fauxpark@gmail.com> | 2022-08-06 22:37:40 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-06 22:37:40 +1000 |
| commit | 37345e2ace56e1ea17e0ab6b4df3af81f437ae79 (patch) | |
| tree | e9c91c998377b98e6b9dc8d03b50193e58bf7061 | |
| parent | 0ff8c4f6fd8cce95d9e96060121208f85b4d02cd (diff) | |
Provide users with replacements for deprecated/invalid functionality where applicable (#17604)
| -rw-r--r-- | data/mappings/info_config.json | 3 | ||||
| -rw-r--r-- | data/mappings/info_rules.json | 5 | ||||
| -rw-r--r-- | lib/python/qmk/info.py | 22 |
3 files changed, 23 insertions, 7 deletions
diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json index 5f0d903bd7..7ff05918e9 100644 --- a/data/mappings/info_config.json +++ b/data/mappings/info_config.json | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | # warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places | 9 | # warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places |
| 10 | # deprecated: Default `false`. Set to `true` to turn on warning when a value exists | 10 | # deprecated: Default `false`. Set to `true` to turn on warning when a value exists |
| 11 | # invalid: Default `false`. Set to `true` to generate errors when a value exists | 11 | # invalid: Default `false`. Set to `true` to generate errors when a value exists |
| 12 | # replace_with: use with a key marked deprecated or invalid to designate a replacement | ||
| 12 | "AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"}, | 13 | "AUDIO_VOICES": {"info_key": "audio.voices", "value_type": "bool"}, |
| 13 | "BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"}, | 14 | "BACKLIGHT_BREATHING": {"info_key": "backlight.breathing", "value_type": "bool"}, |
| 14 | "BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"}, | 15 | "BREATHING_PERIOD": {"info_key": "backlight.breathing_period", "value_type": "int"}, |
| @@ -108,6 +109,6 @@ | |||
| 108 | "NO_ACTION_MACRO": {"info_key": "_invalid.no_action_macro", "invalid": true}, | 109 | "NO_ACTION_MACRO": {"info_key": "_invalid.no_action_macro", "invalid": true}, |
| 109 | "NO_ACTION_FUNCTION": {"info_key": "_invalid.no_action_function", "invalid": true}, | 110 | "NO_ACTION_FUNCTION": {"info_key": "_invalid.no_action_function", "invalid": true}, |
| 110 | "DESCRIPTION": {"info_key": "_invalid.usb_description", "invalid": true}, | 111 | "DESCRIPTION": {"info_key": "_invalid.usb_description", "invalid": true}, |
| 111 | "DEBOUNCING_DELAY": {"info_key": "_invalid.debouncing_delay", "invalid": true}, | 112 | "DEBOUNCING_DELAY": {"info_key": "_invalid.debouncing_delay", "invalid": true, replace_with: "DEBOUNCE"}, |
| 112 | "PREVENT_STUCK_MODIFIERS": {"info_key": "_invalid.prevent_stuck_mods", "invalid": true}, | 113 | "PREVENT_STUCK_MODIFIERS": {"info_key": "_invalid.prevent_stuck_mods", "invalid": true}, |
| 113 | } | 114 | } |
diff --git a/data/mappings/info_rules.json b/data/mappings/info_rules.json index d4eec37ba0..93de321ab1 100644 --- a/data/mappings/info_rules.json +++ b/data/mappings/info_rules.json | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | # warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places | 9 | # warn_duplicate: Default `true`. Set to `false` to turn off warning when a value exists in both places |
| 10 | # deprecated: Default `false`. Set to `true` to turn on warning when a value exists | 10 | # deprecated: Default `false`. Set to `true` to turn on warning when a value exists |
| 11 | # invalid: Default `false`. Set to `true` to generate errors when a value exists | 11 | # invalid: Default `false`. Set to `true` to generate errors when a value exists |
| 12 | # replace_with: use with a key marked deprecated or invalid to designate a replacement | ||
| 12 | "BOARD": {"info_key": "board"}, | 13 | "BOARD": {"info_key": "board"}, |
| 13 | "BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false}, | 14 | "BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false}, |
| 14 | "BLUETOOTH": {"info_key": "bluetooth.driver"}, | 15 | "BLUETOOTH": {"info_key": "bluetooth.driver"}, |
| @@ -29,7 +30,7 @@ | |||
| 29 | "WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"}, | 30 | "WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"}, |
| 30 | 31 | ||
| 31 | # Items we want flagged in lint | 32 | # Items we want flagged in lint |
| 32 | "CTPC": {"info_key": "_deprecated.ctpc", "deprecated": true}, | 33 | "CTPC": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"}, |
| 33 | "CONVERT_TO_PROTON_C": {"info_key": "_deprecated.ctpc", "deprecated": true}, | 34 | "CONVERT_TO_PROTON_C": {"info_key": "_deprecated.ctpc", "deprecated": true, "replace_with": "CONVERT_TO=proton_c"}, |
| 34 | "VIAL_ENABLE": {"info_key": "_invalid.vial", "invalid": true}, | 35 | "VIAL_ENABLE": {"info_key": "_invalid.vial", "invalid": true}, |
| 35 | } | 36 | } |
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 340969f415..ccec46ce21 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py | |||
| @@ -463,10 +463,17 @@ def _extract_config_h(info_data, config_c): | |||
| 463 | key_type = info_dict.get('value_type', 'raw') | 463 | key_type = info_dict.get('value_type', 'raw') |
| 464 | 464 | ||
| 465 | try: | 465 | try: |
| 466 | replace_with = info_dict.get('replace_with') | ||
| 466 | if config_key in config_c and info_dict.get('invalid', False): | 467 | if config_key in config_c and info_dict.get('invalid', False): |
| 467 | _log_error(info_data, '%s in config.h is no longer a valid option' % config_key) | 468 | if replace_with: |
| 469 | _log_error(info_data, '%s in config.h is no longer a valid option and should be replaced with %s' % (config_key, replace_with)) | ||
| 470 | else: | ||
| 471 | _log_error(info_data, '%s in config.h is no longer a valid option and should be removed' % config_key) | ||
| 468 | elif config_key in config_c and info_dict.get('deprecated', False): | 472 | elif config_key in config_c and info_dict.get('deprecated', False): |
| 469 | _log_warning(info_data, '%s in config.h is deprecated and will be removed at a later date' % config_key) | 473 | if replace_with: |
| 474 | _log_warning(info_data, '%s in config.h is deprecated in favor of %s and will be removed at a later date' % (config_key, replace_with)) | ||
| 475 | else: | ||
| 476 | _log_warning(info_data, '%s in config.h is deprecated and will be removed at a later date' % config_key) | ||
| 470 | 477 | ||
| 471 | if config_key in config_c and info_dict.get('to_json', True): | 478 | if config_key in config_c and info_dict.get('to_json', True): |
| 472 | if dotty_info.get(info_key) and info_dict.get('warn_duplicate', True): | 479 | if dotty_info.get(info_key) and info_dict.get('warn_duplicate', True): |
| @@ -527,10 +534,17 @@ def _extract_rules_mk(info_data, rules): | |||
| 527 | key_type = info_dict.get('value_type', 'raw') | 534 | key_type = info_dict.get('value_type', 'raw') |
| 528 | 535 | ||
| 529 | try: | 536 | try: |
| 537 | replace_with = info_dict.get('replace_with') | ||
| 530 | if rules_key in rules and info_dict.get('invalid', False): | 538 | if rules_key in rules and info_dict.get('invalid', False): |
| 531 | _log_error(info_data, '%s in rules.mk is no longer a valid option' % rules_key) | 539 | if replace_with: |
| 540 | _log_error(info_data, '%s in rules.mk is no longer a valid option and should be replaced with %s' % (rules_key, replace_with)) | ||
| 541 | else: | ||
| 542 | _log_error(info_data, '%s in rules.mk is no longer a valid option and should be removed' % rules_key) | ||
| 532 | elif rules_key in rules and info_dict.get('deprecated', False): | 543 | elif rules_key in rules and info_dict.get('deprecated', False): |
| 533 | _log_warning(info_data, '%s in rules.mk is deprecated and will be removed at a later date' % rules_key) | 544 | if replace_with: |
| 545 | _log_warning(info_data, '%s in rules.mk is deprecated in favor of %s and will be removed at a later date' % (rules_key, replace_with)) | ||
| 546 | else: | ||
| 547 | _log_warning(info_data, '%s in rules.mk is deprecated and will be removed at a later date' % rules_key) | ||
| 534 | 548 | ||
| 535 | if rules_key in rules and info_dict.get('to_json', True): | 549 | if rules_key in rules and info_dict.get('to_json', True): |
| 536 | if dotty_info.get(info_key) and info_dict.get('warn_duplicate', True): | 550 | if dotty_info.get(info_key) and info_dict.get('warn_duplicate', True): |
