mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06:00
Update invalid imports checker documentation
Makes it consistent with other checkers we already have
This commit is contained in:
parent
b830a6faa3
commit
2e20bf6a98
2 changed files with 6 additions and 1 deletions
|
@ -56,7 +56,7 @@ function(cura_add_test)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
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(
|
add_test(
|
||||||
NAME "invalid-imports"
|
NAME "invalid-imports"
|
||||||
COMMAND ${Python3_EXECUTABLE} scripts/check_invalid_imports.py
|
COMMAND ${Python3_EXECUTABLE} 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
|
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:
|
class InvalidImportsChecker:
|
||||||
# compile regex
|
# compile regex
|
||||||
REGEX = re.compile(r"^\s*(from plugins|import plugins)")
|
REGEX = re.compile(r"^\s*(from plugins|import plugins)")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue