From 0ed492978aea83205b73127472c3667c601d515b Mon Sep 17 00:00:00 2001 From: skullY Date: Sat, 23 Nov 2019 10:42:39 -0800 Subject: [PATCH] Add pep8-naming to our python linting --- bin/qmk | 5 +++++ lib/python/qmk/cli/doctor.py | 2 +- lib/python/qmk/tests/test_qmk_errors.py | 2 +- requirements.txt | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/qmk b/bin/qmk index 4d5b3d884f66aefff83c0d0cebb59a9a5a1be3b7..60555d3d709bc1b2f521a7196f8de2fe98fd0816 100755 --- a/bin/qmk +++ b/bin/qmk @@ -25,6 +25,11 @@ with open(os.path.join(qmk_dir, 'requirements.txt'), 'r') as fd: line = line.split('#')[0] module = line.split('=')[0] if '=' in line else line + + if module in ['pep8-naming']: + # Not every module is importable by its own name. + continue + if not find_spec(module): print('Could not find module %s!' % module) print('Please run `pip3 install -r requirements.txt` to install the python dependencies.') diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py index 1010eafb33e7c10052c791f2b423f2298d2b50b9..2421e520e0f6fa6e0c103a020b73c365e35748d3 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor.py @@ -39,7 +39,7 @@ def doctor(cli): ok = False # Determine our OS and run platform specific tests - OS = platform.system() + OS = platform.system() # noqa (N806), uppercase name is ok in this instance if OS == "Darwin": cli.log.info("Detected {fg_cyan}macOS.") diff --git a/lib/python/qmk/tests/test_qmk_errors.py b/lib/python/qmk/tests/test_qmk_errors.py index 1d8690b7efc55764709c9383aafb23ca51f9a77e..948e7ef7413f2be6a022e22a90b77f2d6395ee39 100644 --- a/lib/python/qmk/tests/test_qmk_errors.py +++ b/lib/python/qmk/tests/test_qmk_errors.py @@ -1,7 +1,7 @@ from qmk.errors import NoSuchKeyboardError -def test_NoSuchKeyboardError(): +def test_nosuchkeyboarderror(): try: raise NoSuchKeyboardError("test message") except NoSuchKeyboardError as e: diff --git a/requirements.txt b/requirements.txt index 033b688fc6aa96bba447514309f4ba7ec532f197..074b11a8ceed9b1648e505118d865aa493a9a467 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ colorama hjson nose2 flake8 +pep8-naming