mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
printer-linter works of definitions, profiles and meshes;
It has various diagnostic checks. With possible suggestions for fixes.
It should also be able to fix certain diagnostic issues and it can be used
to format the files according to code-style.
It can output the diagnostics in a yaml file, which can then be used to comment
on PR's with suggestions to the author. Future PR.
The settings for the diagnostics and checks are defined in `.printer-linter`
and are very self explanatory.
```
checks:
diagnostic-mesh-file-extension: true
diagnostic-mesh-file-size: true
diagnostic-definition-redundant-override: true
fixes:
diagnostic-definition-redundant-override: true
format:
format-definition-bracket-newline: false
format-definition-paired-coordinate-array: true
format-definition-sort-keys: true
format-definition-indent: 4
format-profile-space-around-delimiters: true
format-profile-sort-keys: true
diagnostic-mesh-file-size: 1200000
```
20 lines
653 B
Python
20 lines
653 B
Python
from .defintion import Definition
|
|
from .diagnostic import Diagnostic
|
|
from .meshes import Meshes
|
|
from .profile import Profile
|
|
|
|
__all__ = ["Profile", "Definition", "Meshes", "Diagnostic", "create"]
|
|
|
|
|
|
def create(file, settings):
|
|
if not file.exists():
|
|
return None
|
|
if ".inst" in file.suffixes and ".cfg" in file.suffixes:
|
|
return Profile(file, settings)
|
|
if ".def" in file.suffixes and ".json" in file.suffixes:
|
|
if file.stem in ("fdmprinter.def", "fdmextruder.def"):
|
|
return None
|
|
return Definition(file, settings)
|
|
if file.parent.stem == "meshes":
|
|
return Meshes(file, settings)
|
|
return None
|