QuickFix/Precompile
Available from TwinCAT 3.1 Build 4026 |
Some rules from Static Analysis can already be checked during precompilation. For the detection of such rule violations no explicit execution of the Static Analysis is necessary, but the check already takes place on the basis of the precompile information during editing. The checking of a rule during precompilation takes place only if the rule is enabled in the Static Analysis settings.
Precompile: Wavy underline and display in the message window
When a rule violation occurs, it is immediately indicated by wavy underline in the declaration editor or in the ST editor. Additionally - as long as the editor is open - error messages or warnings appear in the message window in the category "IntelliSense". These contain the note "(precompile)" following the rule number.
QuickFix commands
In addition, for some rules that can be checked during precompilation, there is the possibility of a QuickFix in the declaration editor and the ST editor. You can perform automatic, immediate error handling directly at the affected code locations. For quick error handling, click on the wavy underlined code in the editor and then click on the light bulb icon.
Depending on the error, the following QuickFix commands are offered:
- Ignore error message/warning:
The command causes pragmas or attributes to be automatically inserted into the code that exclude checking the associated rule for that line of code. - Ignore error message/warning globally for the POU:
The command causes an attribute to be automatically inserted at the beginning of the declaration part of the programming object. Then a check of the associated rule for this programming object is excluded. - Disable checking:
The command causes the checking of the associated rule to be disabled in the settings. - Fix error by suggesting to change ST code:
Example for "SA0033: Unused variables": The declaration of the unused variables is removed from the declaration editor.
Available rules
Please note that not all rules can be checked during precompilation. Based on the precompile information, the following rules are checked:
SA0001, SA0002, SA0011, SA0020, SA0022, SA0033, SA0034, SA0054, SA0090, SA0113, SA0114, SA0115, SA0117, SA0164, SA0168, SA0169, SA0170, SA0171