mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 00:36:25 +08:00
Update invalid imports checker documentation
Makes it consistent with other checkers we already have
This commit is contained in:
parent
b830a6faa3
commit
2e20bf6a98
@ -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…
x
Reference in New Issue
Block a user