diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2020-01-20 18:33:03 +0300 |
---|---|---|
committer | Nino van Hooff <ninovanhooff@gmail.com> | 2020-01-20 18:35:32 +0300 |
commit | 2e20bf6a983dfd4fcfad56aecb3ce41f53621b31 (patch) | |
tree | 7019fcfa1f00db489f052497bc2f646a26e530eb | |
parent | b830a6faa3f83814b795fdca41bb73b90e48ac68 (diff) |
Update invalid imports checker documentation
Makes it consistent with other checkers we already have
-rw-r--r-- | cmake/CuraTests.cmake | 2 | ||||
-rw-r--r-- | scripts/check_invalid_imports.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake index c76019d310..251bec5781 100644 --- a/cmake/CuraTests.cmake +++ b/cmake/CuraTests.cmake @@ -56,7 +56,7 @@ function(cura_add_test) endif() endfunction() -#Add test for whether the shortcut alt-keys are unique in every translation. +#Add test for import statements which are not compatible with all builds add_test( NAME "invalid-imports" COMMAND ${Python3_EXECUTABLE} scripts/check_invalid_imports.py diff --git a/scripts/check_invalid_imports.py b/scripts/check_invalid_imports.py index 121184e739..ba21b9f822 100644 --- a/scripts/check_invalid_imports.py +++ b/scripts/check_invalid_imports.py @@ -5,8 +5,13 @@ from pathlib import Path """ Run this file with the Cura project root as the working directory +Checks for invalid imports. When importing from plugins, there will be no problems when running from source, +but for some build types the plugins dir is not on the path, so relative imports should be used instead. eg: +from ..UltimakerCloudScope import UltimakerCloudScope <-- OK +import plugins.Toolbox.src ... <-- NOT OK """ + class InvalidImportsChecker: # compile regex REGEX = re.compile(r"^\s*(from plugins|import plugins)") |