91 Commits

Author SHA1 Message Date
Erwan MATHIEU
90115808ee Use yaml.safe_load instead of yaml.load
CURA-12548
Note that this is not technically required, because external contributors can change it anyway. However, making this change will silent a security warning raised by an automatic analysis tool, and it doesn't hurt.
2025-03-14 11:38:45 +01:00
Erwan MATHIEU
9e2c440097 Fix false warnings on setting formulas
We also need to consider the extruder settings when looking into formulas for existing values.
2024-06-28 15:36:10 +02:00
Erwan MATHIEU
de81612300 Fix crash when parent definition has no experimental settings
CURA-10899
2024-06-19 16:27:05 +02:00
Erwan MATHIEU
c937b1d4db Remove debug output
CURA-10899
2024-06-19 16:17:41 +02:00
Erwan MATHIEU
35a5abc66d Add check for experimental settings
CURA-10899
2024-06-17 16:02:36 +02:00
Erwan MATHIEU
ee227673d1 Fix crash when trying to parse translation files
As some translation files are named with a .def.json.pot extension, they were previously considered for checking as if they were definition files. They are now filtered out.
2024-06-17 14:43:52 +02:00
Erwan MATHIEU
0f805983a2 Fix possible crash of profile name checker 2024-06-17 14:31:50 +02:00
Erwan MATHIEU
639fcca86a Fix possible crash of formulas checker 2024-06-17 13:59:56 +02:00
Saumya Jain
284f8e2d6d
Merge branch 'main' into CURA-10901-warn-if-formulas-are-NOK 2024-04-26 12:08:12 +02:00
HellAholic
fdc2688413
Update printer-linter/src/printerlinter/linters/profile.py 2024-04-26 11:49:54 +02:00
HellAholic
4495f64753 Revert "Update printer-linter/src/printerlinter/linters/profile.py"
This reverts commit d6164fddaec6fa83e6cd39220c927d855c7ec2bc.
2024-04-26 11:39:39 +02:00
HellAholic
d6164fddae
Update printer-linter/src/printerlinter/linters/profile.py 2024-04-26 11:36:12 +02:00
Saumya Jain
ec6c7f109c
removed non necessary yield 2024-04-26 10:29:42 +02:00
Saumya Jain
467801bf9e
Apply suggestions from code review
Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>
2024-04-26 10:26:52 +02:00
Saumya Jain
0ce09d917c message has profile name in bold
CURA-11153
2024-04-24 11:01:30 +02:00
Saumya Jain
56aad519ae Changed message
CURA-11153
2024-04-24 10:59:36 +02:00
Saumya Jain
196a4cf0c0 Refactor profile name check method in linter
CURA-11153
2024-04-24 10:51:48 +02:00
Saumya Jain
ceb5e7096e Add new linter for long profile names
CURA-11153
2024-04-24 10:32:29 +02:00
Saumya Jain
039b6ed2c2 Remove 'upper' from available formula functions
CURA-10901
2024-04-19 17:32:40 +02:00
Saumya Jain
72bf639bea Remove unnecessary formulas from linter
These formulas or modules are not used in definition files , so removing them

CURA-10901
2024-04-19 17:31:08 +02:00
Saumya Jain
1f2e690809 Extend list of formula names in linter
The list of formula names in the printer-linter's formula linter has been expanded. New entries include various mathematical functions (e.g., "max", "min", "sqrt"), string manipulation functions ("lower", "upper", "startswith"), and cryptographic/hash functions ("hashlib", "md5").
2024-04-19 17:02:58 +02:00
Saumya Jain
fd388b5cb3 Modify Formulas class description and simplify return statement
CURA-10901
2024-04-18 11:53:38 +02:00
Saumya Jain
8449d6d953
Merge branch 'main' into CURA-10901-warn-if-formulas-are-NOK 2024-04-10 15:03:53 +02:00
Saumya Jain
84f90eadf8 Adding strip as the github actions were not picking up text with extra spaces
CURA-10901
2024-04-10 14:53:49 +02:00
Saumya Jain
c6ff0d3030 Enhance error reporting for deleted files
The code now checks if a requested file is present in the files list before diagnosing issues and generating error reports for it. It will help prevent attempting to diagnose or report on files that do not exist or deleted, thus enhancing efficiency and preventing possible error generation

CURA-10903
2024-04-10 14:50:26 +02:00
Saumya Jain
a965392559 Update method for getting PR number and modify output report
The code updates the way we fetch the Pull Request number in the Github action. Rather than using an external action, we directly make use of Github's CLI, which helps improve the speed and reliability of the workflow. Additionally, the output report's format in terminal.py, previously named as "Git Comment", has been changed to "Error Files" to better reflect the information it carries.

CURA-10903
2024-04-10 14:16:25 +02:00
Saumya Jain
3987969a22 Simplify and optimize Cura settings list retrieval
Related Task: CURA-10901
2024-04-10 11:37:19 +02:00
Saumya Jain
dcd673a605 Refactor and enhance formula linter in printer-linter module
The update improves formula linting by refining the identification and correction processes of formula typos. It establishes a list of standard formula names and delimiters for better match and replacement operations. Additionally, it enhances error reporting, providing users with more specific and instructive feedback. The Cura settings list retrieval method has been optimized as well.

Related Task: CURA-10901
2024-04-10 10:53:17 +02:00
Saumya Jain
db0e46b252 Improve formula checks and error messages in printer-linter
This update enhances the checking of formula correctness in printer settings and provides clearer error messages when formulas appear incorrect. By getting a list of Cura setting variables and typical formula names, it uses these to match and replace incorrect segments in formulas, if any. Related code for error handling and message reporting are also revised to give more useful feedback to users for necessary corrections.

CURA-10901
2024-04-10 10:42:17 +02:00
Saumya Jain
01552556d8 Fix formula check and correct error message
CURA-10901
2024-04-09 16:19:49 +02:00
Saumya Jain
9db52e3888 Adding the replacement text for the maybe corrected formula
CURA-10901
2024-04-09 16:10:27 +02:00
Saumya Jain
bb94ce9e75 fixing typo checks
CURA-10903
2024-04-09 11:37:42 +02:00
Saumya Jain
561a40d000 Implement GitComment class and update workflow files
A new GitComment class was implemented to replace Diagnostic for deleted file checks. As part of this change, both main workflow files (printer-linter-pr-diagnose.yml and printer-linter-pr-post.yml) have been updated to accommodate this new class. Also, reports now use 'comment.md' instead of 'fixes.yml'. All of this is ultimately geared at improving diagnostic functionality and allowing deleted file checks to output directly to a Git comment.

CURA-10903
2024-04-09 11:33:24 +02:00
Saumya Jain
eecf9cdebf Refactor formulas.py for improved formula handling
Imported difflib, re, and CuraFormulaFunctions for more efficient formula handling and error checking. This prevents crashes and improves the reliability of the application by suggesting the correct formula when an incorrect one is entered

CURA-10901
2024-04-08 17:56:14 +02:00
Saumya Jain
e15049f2e0 Update formulas handling
CURA-10901
2024-04-08 15:26:55 +02:00
Saumya Jain
702f8573c3
Merge branch 'main' into CURA-10903-warn-for-deleted-files 2024-04-08 14:03:48 +02:00
Saumya Jain
388be81116
Merge branch 'main' into CURA-10901-warn-if-formulas-are-NOK 2024-04-08 14:02:00 +02:00
Saumya Jain
29617ea22f removed path with parent because it doesn't exist anymore 2024-04-08 12:42:33 +02:00
Saumya Jain
8e9ebb6832 Consistent for naming convention
CURA-10901
2024-04-08 10:25:23 +02:00
Saumya Jain
fe0120ef64 Add Formulas linter and integrate with factory
A new linter class, Formulas, has been added to check for issues in definition files, particularly with default parameters overrides. It has been integrated into the Linter factory to also check '.inst.cfg' and '.def.json' files for formulas-related issues. Additionally, a new 'diagnostic-incorrect-formula' check has been included in the .printer-linter configuration.

CURA-10901
2024-04-05 18:18:40 +02:00
Saumya Jain
38382eeec7 Add detection for deleted files in printer linter
This update adds a new check for deleted files in the printer linter. This will alert the user when a file has been deleted that could potentially disrupt upgrade scripts. An argument "--deleted" is also added to terminal.py to facilitate this new check. Additionally, the printer-linter version has been incremented to 0.1.2.

CURA-10903
2024-04-05 15:55:30 +02:00
Saumya Jain
794cdfd077 Same as before.
CURA-10904
2024-04-05 11:59:39 +02:00
Saumya Jain
6609741323 Fix potential key error in printer linter
CURA-10904
2024-04-05 10:06:28 +02:00
Saumya Jain
e5fb40b48c Add material temperature check in linter
CURA-10904
2024-04-05 10:02:08 +02:00
jellespijker
658f270fe1 removed debugging statement
Contributes to CURA-11014
2023-09-22 01:30:00 +02:00
jellespijker
b401ecee02 Add MacOS directory naming linting
A new Linter subclass - 'Directory' has been created and integrated into the linting process to handle directory naming conventions, specifically for MacOS. MacOS has issues when signing and notarizing directories with '.' in their names. The new class will trigger an 'Error' level diagnostic if this convention is violated. The linter will become a required check with this update, as its new check configuration was added to '.printer-linter'. The version number in 'pyproject.toml' was also incremented to reflect these changes.

Contributes to CURA-11014
2023-09-22 01:29:22 +02:00
jspijker
ab86a85c77 Ignore redundant-override in the machine_* types 2023-01-10 11:02:08 +01:00
jspijker
6b810fbd6c Allow for wildcard with printer-linter 2022-12-30 21:59:43 +01:00
Jelle Spijker
cab248c131 Use the same MAX_MESH_FILE_SIZE as the UT 2022-12-28 13:11:57 +01:00
Jelle Spijker
6109b4b9da distinguish between (default_)value and other properties 2022-12-13 14:36:14 +01:00