summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-09-27 10:02:54 -0700
committerGitHub <noreply@github.com>2021-09-27 10:02:54 -0700
commitfce9cb933845bf0b74d322eba02de3b76daaeb84 (patch)
treea28ffc6f3c53a4ddf1004f1a99938e2e5a42e6c3 /lib/python/qmk/cli
parent5f38a98fa07677be960b71b8e3b0a1785effe0d8 (diff)
downloadqmk_firmware-fce9cb933845bf0b74d322eba02de3b76daaeb84.tar.gz
qmk_firmware-fce9cb933845bf0b74d322eba02de3b76daaeb84.zip
Cleanup issues identified by lgtm (#14459)
* cleanup issues identified by lgtm * fix the git_status check
Diffstat (limited to 'lib/python/qmk/cli')
-rw-r--r--lib/python/qmk/cli/doctor/linux.py8
-rwxr-xr-xlib/python/qmk/cli/doctor/main.py9
-rwxr-xr-xlib/python/qmk/cli/generate/config_h.py2
-rw-r--r--lib/python/qmk/cli/generate/dfu_header.py2
-rwxr-xr-xlib/python/qmk/cli/generate/keyboard_h.py2
-rwxr-xr-xlib/python/qmk/cli/generate/layouts.py2
6 files changed, 12 insertions, 13 deletions
diff --git a/lib/python/qmk/cli/doctor/linux.py b/lib/python/qmk/cli/doctor/linux.py
index 6ce00f6ef1..94683d3307 100644
--- a/lib/python/qmk/cli/doctor/linux.py
+++ b/lib/python/qmk/cli/doctor/linux.py
@@ -118,10 +118,9 @@ def check_udev_rules():
cli.log.warning("{fg_yellow}Found old, deprecated udev rules for '%s' boards. The new rules on https://docs.qmk.fm/#/faq_build?id=linux-udev-rules offer better security with the same functionality.", bootloader)
else:
# For caterina, check if ModemManager is running
- if bootloader == "caterina":
- if check_modem_manager():
- rc = CheckStatus.WARNING
- cli.log.warning("{fg_yellow}Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.")
+ if bootloader == "caterina" and check_modem_manager():
+ cli.log.warning("{fg_yellow}Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.")
+
rc = CheckStatus.WARNING
cli.log.warning("{fg_yellow}Missing or outdated udev rules for '%s' boards. Run 'sudo cp %s/util/udev/50-qmk.rules /etc/udev/rules.d/'.", bootloader, QMK_FIRMWARE)
@@ -167,6 +166,5 @@ def os_test_linux():
return CheckStatus.OK
else:
cli.log.info("Detected {fg_cyan}Linux{fg_reset}.")
- from .linux import check_udev_rules
return check_udev_rules()
diff --git a/lib/python/qmk/cli/doctor/main.py b/lib/python/qmk/cli/doctor/main.py
index 6a31ccdfdd..ed20f46d3f 100755
--- a/lib/python/qmk/cli/doctor/main.py
+++ b/lib/python/qmk/cli/doctor/main.py
@@ -79,12 +79,13 @@ def doctor(cli):
cli.log.info('CLI version: %s', cli.version)
cli.log.info('QMK home: {fg_cyan}%s', QMK_FIRMWARE)
- status = os_tests()
+ status = os_status = os_tests()
+ git_status = git_tests()
- status = git_tests()
+ if git_status == CheckStatus.ERROR or (os_status == CheckStatus.OK and git_status == CheckStatus.WARNING):
+ status = git_status
- venv = in_virtualenv()
- if venv:
+ if in_virtualenv():
cli.log.info('CLI installed in virtualenv.')
# Make sure the basic CLI tools we need are available and can be executed.
diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py
index ca7e14fe6b..f16dca1de8 100755
--- a/lib/python/qmk/cli/generate/config_h.py
+++ b/lib/python/qmk/cli/generate/config_h.py
@@ -173,7 +173,7 @@ def generate_config_h(cli):
kb_info_json = dotty(info_json(cli.args.keyboard))
# Build the info_config.h file.
- config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.' ' */', '', '#pragma once']
+ config_h_lines = ['/* This file was generated by `qmk generate-config-h`. Do not edit or copy.', ' */', '', '#pragma once']
generate_config_items(kb_info_json, config_h_lines)
diff --git a/lib/python/qmk/cli/generate/dfu_header.py b/lib/python/qmk/cli/generate/dfu_header.py
index 211ed9991a..5a1b109f1e 100644
--- a/lib/python/qmk/cli/generate/dfu_header.py
+++ b/lib/python/qmk/cli/generate/dfu_header.py
@@ -30,7 +30,7 @@ def generate_dfu_header(cli):
# Build the Keyboard.h file.
kb_info_json = dotty(info_json(cli.config.generate_dfu_header.keyboard))
- keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.' ' */', '', '#pragma once']
+ keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once']
keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}')
keyboard_h_lines.append(f'#define PRODUCT {cli.config.generate_dfu_header.keyboard} Bootloader')
diff --git a/lib/python/qmk/cli/generate/keyboard_h.py b/lib/python/qmk/cli/generate/keyboard_h.py
index c9d7f549b3..f05178cede 100755
--- a/lib/python/qmk/cli/generate/keyboard_h.py
+++ b/lib/python/qmk/cli/generate/keyboard_h.py
@@ -36,7 +36,7 @@ def generate_keyboard_h(cli):
has_layout_h = would_populate_layout_h(cli.args.keyboard)
# Build the layouts.h file.
- keyboard_h_lines = ['/* This file was generated by `qmk generate-keyboard-h`. Do not edit or copy.' ' */', '', '#pragma once', '#include "quantum.h"']
+ keyboard_h_lines = ['/* This file was generated by `qmk generate-keyboard-h`. Do not edit or copy.', ' */', '', '#pragma once', '#include "quantum.h"']
if not has_layout_h:
keyboard_h_lines.append('#pragma error("<keyboard>.h is only optional for data driven keyboards - kb.h == bad times")')
diff --git a/lib/python/qmk/cli/generate/layouts.py b/lib/python/qmk/cli/generate/layouts.py
index 4de982f822..e44266e1c8 100755
--- a/lib/python/qmk/cli/generate/layouts.py
+++ b/lib/python/qmk/cli/generate/layouts.py
@@ -38,7 +38,7 @@ def generate_layouts(cli):
kb_info_json = info_json(cli.config.generate_layouts.keyboard)
# Build the layouts.h file.
- layouts_h_lines = ['/* This file was generated by `qmk generate-layouts`. Do not edit or copy.' ' */', '', '#pragma once']
+ layouts_h_lines = ['/* This file was generated by `qmk generate-layouts`. Do not edit or copy.', ' */', '', '#pragma once']
if 'matrix_pins' in kb_info_json:
if 'direct' in kb_info_json['matrix_pins']: