.

Release Notes: CODESYS Static Analysis 5.0.0.0

Key Issue Type Summary Resolution Note
SAN-1463 Improvement

Remove chm files from package

Fixed
SAN-1418 Bug

NC0026 : false positiv for ARRAY [*]

Fixed
SAN-1413 Improvement

SA0101: Implement Quickfix

Fixed
SAN-1411 Improvement

SA0077: Implement Quickfix

Fixed
SAN-1407 Improvement

SA0036: Implement Quickfix

Fixed
SAN-1406 Improvement

SA0035: Implement Quickfix

Fixed
SAN-1404 Improvement

SA0046: Quickfixes AND -> AND_THEN and OR -> OR_ELSE

Fixed
SAN-1403 Improvement

SA0145: Quickfixes AND -> AND_THEN and OR -> OR_ELSE

Fixed
SAN-1401 Bug

Static analysis tests are also done in undefined statements

Fixed
SAN-1399 Bug

License: Network license is not recognized if an expired demo license is still activated locally

Cannot Reproduce [[GENERAL]]
This issue cannot be reproduced with SAN Versions starting from 4.4.3.0. If older versions are affected by this issue a remove license-ticket to remove the old demo licenses has to be requested from the support.
SAN-1396 Bug

SA0076 at Case Structure, although requested Type exsists

Fixed
SAN-1391 Bug

Errormessage of SA0017 Non-regular assignment is confusing

Fixed [[GENERAL]]
New text for the rule and the error message: "Unusual assignment to pointer variable"
SAN-1389 Bug

Spelling Error: In rule SA0019 implicit conversion from pointer

Fixed
SAN-1384 Improvement

Rework Pretty Printer Options

Fixed
SAN-1382 Improvement

Wrong path to References

Fixed
SAN-1380 Improvement

Update sdk and target to 3.5.20.0

Fixed
SAN-1379 Improvement

Combine functionality for Getting and Setting TextDoctuments

Fixed
SAN-1374 Bug

Wrong message "SA0056: Constant out of valid range" if a real variable is used

Fixed
SAN-1256 Improvement

Metrics: Open view of cognitive complexity increments from messageview

Fixed
SAN-1255 Improvement

Add contextsensitive help of command "Show values of constant propagation for current editor"

Fixed
SAN-1252 Bug

False Positive, SA0037: Writing a member via pointer is reported as write access on VAR_INPUT

Cannot Reproduce [[GENERAL]]
Already fixed with SAN-1390
SAN-1241 Bug

Exception for Test "useless assignment" for POUs with IF-pragma

Fixed
SAN-1240 Improvement

Fix spelling diffrences between source code and english localisation

Fixed
SAN-1234 Bug

Metric: RFC (Response for Class) is calculated wrong

Fixed
SAN-1232 Bug

Metric: McCabe complexity is incremented twice for ELSIF branches

Fixed
SAN-1231 Bug

Metric: McCabe complexity is not incremented for ELSE branches in CASE statements

Fixed
SAN-1229 Bug

SAN Precompile: No precompile id in special constellation with method using SUPER^

Fixed
SAN-1221 Bug

Static Analysis: Don't show enumerations in the standard metrics

Fixed [[GENERAL]]
Because metrics are not calculated for ENUMs, ENUMs are no longer displayed in the metric table
SAN-1218 Improvement

Performance improvement for precompile checks

Fixed
SAN-1213 Improvement

StatisAnalysisManager in Static Analysis Addon

Fixed
SAN-1209 Improvement

Consolidate the PrecompiledTestContext.AddError methods

Fixed
SAN-1207 Improvement

Replace class CDSEnvironment by dependency injection

Fixed
SAN-1197 Bug

SA0002 for SFC POUs

Fixed
SAN-1196 Improvement

Quickfixes: new interface neccessary that uses the white parse tree services

Fixed
SAN-1195 Improvement

SA0001: Unreachable code: Add more cases

Won't Fix [[GENERAL]]
Will not be implemented. The examples given are not realistic:
IF 1=1 THEN
IF iCounter=iCounter THEN
SAN-1193 Bug

Rule #41 loop invariant code: Error is reported twice.

Fixed
SAN-1167 Improvement

Precompile SAN messages should be displayed even if there are compile errors in project

Fixed
SAN-1164 Improvement

Display progress and and cancellation for Run static analysis

Duplicate [[GENERAL]]
Already fixed with SAN-1218
SAN-1161 Bug

Quickfix: Ignore warning quickfix has no effect in Graphical Editors

Fixed [[GENERAL]]
The option is not displayed anymore for errors in graphical editors.
SAN-1141 Bug

SA0034: Error is reported although the return value of a function of type Enum is assigned to a variable of type Enum

Fixed
SAN-1140 Improvement

New check for for loop that doesn't cover whole array

Fixed [[GENERAL]]
There is now a new rule to check if an index in a loop does not cover the whole array size.
The check occurs if the index is not a single value but a value range and the range is a real subset of the array range.
SAN-1137 Improvement

SA0039: Quickfix AND -> AND_THEN and OR -> OR_ELSE

Fixed
SAN-1136 Improvement

Improve metric for ratio of comments

Fixed [[GENERAL]]
The previously used check against the visibility of variables in the declaration part (e.g. comment of hidden VAR_INPUT was not considered) is no longer active.
SAN-1133 Bug

False positive for SA0077

Cannot Reproduce
SAN-1123 Improvement

Improve timing and responsiveness of precompile checking

Fixed
SAN-1116 Epic

Exchange THEN and ELSE of IF-Statements

Fixed [[GENERAL]]
A new refatoring command is available which allows to switch the THEN and ELSE branches of an IF statement to simplify the condition and improve code flow and readability.
SAN-1112 Improvement

Convert SA0167: Temporary function block instances to precompile

Fixed
SAN-1111 Improvement

Convert SA0166: Max. number of input/output/in-out variable to precompile

Fixed
SAN-1110 Improvement

Convert SA0165: Tasks calling other POUs than programs to precompile

Fixed
SAN-1109 Improvement

Convert SA0125: References in initializations to precompile

Fixed
SAN-1108 Improvement

Convert SA0124: Pointer dereferences in declarations to precompile

Fixed
SAN-1107 Improvement

Convert SA0118: Initialisations not using constants to precompile

Fixed
SAN-1106 Improvement

Convert SA0112: Reference variables to precompile

Fixed
SAN-1105 Improvement

Convert SA0111: Pointer variables to precompile

Fixed
SAN-1104 Improvement

Convert A0102: Access to program/fb variables from the outside to precompile

Fixed
SAN-1103 Improvement

Convert SA0101: Names with invalid lengths to precompile

Fixed
SAN-1102 Improvement

Convert SA0048: AT-declarations on direct addresses to precompile

Fixed
SAN-1101 Improvement

Convert SA0044: Declarations with reference to interface to precompile

Fixed
SAN-1100 Improvement

Convert SA0043: Use of a global variable in only one POU to precompile

Fixed
SAN-1099 Improvement

Convert SA0041: Detect possible loop invariant code in precompile

Fixed
SAN-1098 Improvement

Convert SA0036: Unused output variables to precompile

Fixed
SAN-1097 Improvement

Convert SA0035: Unused input variables to precompile

Fixed
SAN-1096 Improvement

Convert SA0032: Unused enumeration constants to precompile

Fixed
SAN-1095 Improvement

Convert SA0031: Unused signatures to precompile

Fixed [[GENERAL]]
In precompile there are missing informations e.g. for properties
=> Rule remains in compile
SAN-1094 Improvement

Convert SA0023: Complex return values to precompile

Fixed
SAN-1093 Improvement

Convert SA0012: Variable which could be declared as constants to precompile

Fixed
SAN-1092 Improvement

Convert SA0005: Invalid addresses and data types to precompile

Fixed
SAN-1090 Improvement

Remove unnecessary metrics

Fixed
SAN-1086 Improvement

Create standard metric for cognitive complexity

Fixed
SAN-1080 Improvement

SA0140: Implement Quickfix

Fixed
SAN-1075 Improvement

SA0075: Add missing Else branch

Fixed
SAN-1072 Improvement

SA0060: Implement Quickfix

Fixed
SAN-1071 Improvement

SA0029: Implement Quickfix - Notation in code must equal declaration

Fixed
SAN-1069 Improvement

SA0025: Implement Quickfix

Fixed
SAN-1068 Improvement

SA0024: Implement Quickfix

Duplicate [[GENERAL]]
Duplicate of SAN-1056
SAN-1066 Improvement

SA0012: Implement Quickfix

Fixed
SAN-1065 Improvement

Merge WhiteParseTree and PrettyPrinter into StaticAnalysis plugin and remove WhiteParseTree interface

Fixed
SAN-1058 Improvement

Less Exceptions in SAN

Fixed
SAN-1057 Improvement

Constant Propagation: Conditions, evaluating to FALSE not always result in "Bottom-branch"

Fixed
SAN-1056 Improvement

Quickfix for SA0024: Untyped literal

Fixed
SAN-1054 Improvement

New SAN-Commands should not run on code with precompile errors

Fixed
SAN-1050 Improvement

[Technical Debt] Static Analysis Professional: remove 12 issues reported by SonarQube in Common.cs

Fixed
SAN-1048 Bug

Strings.en.resx contains double colon in string "Statements commented out"

Duplicate
SAN-1042 Improvement

Refactor ITestContext to PrecompiledTestContext

Fixed
SAN-1035 Improvement

Pretty Printer Icon

Fixed
SAN-1030 Bug

SA0077: False positive if CASE variable is a VAR_IN_OUT variable

Fixed [[GENERAL]]
The rule SA0077 only reports mismatches of CASE variables, if one of the variables is an enum.
SAN-1018 Improvement

Precompile: Move StaticAnalysisExprVisistor to precompile.

Fixed
SAN-1014 Improvement

Naming Conventions: Sort prefixes for custom types

Fixed
SAN-1010 Improvement

Use precompile rule checkers for "Run static Analysis" Command

Fixed
SAN-1001 Bug

SA0164: Exception in project with SVN_VERSION_INFO

Fixed [[GENERAL]]
The rule 164 is no longer checked for objects like the SVN_VERSION_INFO object, that does not belong to the user code but is provided by the system (e.g. the svn Addon)
SAN-994 Epic

Rework Metrics

Fixed
SAN-988 Epic

M6 Switch to provider-agnostic licensing

Fixed
SAN-976 Improvement

Pretty Printer Improvements

Fixed
SAN-973 Bug

SAN: Rules export error when filter is enabled

Fixed
SAN-971 Bug

SA0130: Check if simple assignments could be excluded from SA0130 reporting

Fixed [[GENERAL]]
Now only reported for arithmetic operations that are implicitly cast to larger data types.
SAN-956 Bug

Naming Conventions: Prefixes of automatically declared SFC flags are checked (NC0003, NC0019)

Fixed
SAN-955 Bug

SA0145: False positive if checking REFERENCE TO ARRAY via __ISVALIDREF

Cannot Reproduce [[GENERAL]]
Cannot reproduce with SAN 5.0.0.0
SAN-949 Bug

Improve code quality to meet sonarqube guidelines

Fixed
SAN-947 Bug

SA0046: False positive when check of interface variable is done behind AND_THEN

Cannot Reproduce [[GENERAL]]
Cannot reproduce with SAN 5.0.0.0
SAN-946 Bug

Static Analysis: Codeline isn't resolved for some errors

Fixed [[GENERAL]]
Fixed for the rules SA011, SA0022 and SA0026.

[[KNOWN_LIMITATIONS]]
No suitable source position is available for the rule SA0002, because the corresponding error message affects the entire object and not a particular piece of source code
SAN-945 Bug

SA0008: False positive when assigning subrange type variable to another subrange type variable with same or bigger range

Fixed [[GENERAL]]
Cannot be reproduced with SAN 5.0.0.0
Unittest added
SAN-941 Improvement

Reactivate performance measuring of precompile checks

Fixed [[GENERAL]]
Die PerformanceTests stehen jetzt als seperates UnitTest-Projekt in der StaticAnalysisSolution zur Verfügung. Die Tests werden nur in der Konfiguration Performance ausgeführt.
SAN-940 Improvement

StaticAnalysis: Upgrade to language version 8.0 and enable nullable checks

Fixed
SAN-937 Improvement

Integrate white parse trees from branch into trunk

Fixed
SAN-934 Improvement

Static Analysis: with {attribute 'no_explicit_call' := 'Use methods instead'} no Error Message should appear

Fixed
SAN-932 Bug

[SA0058]: SAN cannot properly handle code that has been constant-folded by the compiler

Cannot Reproduce [[GENERAL]]
Cannot reproduce with SAN 5.0.0.0
SAN-930 Bug

Static Analysis precompile errors are not reported reliably in a new project

Fixed
SAN-906 Epic

Provide service for concrete parse trees

Fixed
SAN-901 Bug

Settings Dialog: Export functionality exports rules twice

Fixed
SAN-899 Improvement

SAN messages with quickfixes might need better position information

Fixed
SAN-892 Bug

SA0061: False positive when pointer check in IF condition is only one of several condition parts

Fixed
SAN-883 Bug

SA0066: Use of temporary result wrong detected

Fixed
SAN-882 Bug

SA0056: Constant out of valid range wrong detected

Fixed
SAN-881 Improvement

Create a better message for SA0170

Fixed
SAN-878 Bug

Clone Detection: Exceptions with a special project

Fixed
SAN-873 Bug

SA0031: Unused method "FB_ReInit"

Fixed
SAN-870 Improvement

New Static Analysis Rule: Suspicious Operation on String

Fixed [[GENERAL]]
See CDS-77546
SAN-868 Bug

SA0102: when accessing the local variables of a POU within a visu, you get the following error SA0102

Fixed
SAN-866 Bug

SA0162: False positive reported for commented temporary variable

Cannot Reproduce [[GENERAL]]
That the variable tempvar3 is reported as undocumented is "as designed", because a comment after a variable declaration (on the same line) belongs to the variable before it
SAN-857 Bug

SA0132: False positive when decrementing loop counter

Cannot Reproduce
SAN-855 Bug

SA0145: Error is reported three times for one positive case

Fixed
SAN-854 Bug

SA0124: False positive if assigning THIS pointer to FB input

Fixed
SAN-845 Bug

Not all errors are detected for ARRAY OF ARRAY

Cannot Reproduce
SAN-823 Bug

Static Analysis: Unnecessary positives for abstract methods

Fixed
SAN-814 Bug

SA0039: False positive when accessing VAR_STAT

Cannot Reproduce [[GENERAL]]
Cannot reproduce
SAN-813 Bug

SA0065: Incorrect violation reported when using constants in the calculation

Fixed [[GENERAL]]
Multiplication products of the base size are no longer reported as errors
SAN-810 Bug

SA0031: Functions with call_after_init are not unused

Fixed [[GENERAL]]
POUs with attribute "linkalways" or "call_after_global_init_slot" are no longer reported as unused
SAN-808 Bug

SA0046: False positive checking for uninitialized variable

Fixed
SAN-807 Improvement

Support for modularized codesys

Cannot Reproduce [[GENERAL]]
Already implemented with SAN-909 (Necessary to get the gitlab pipeline of SAN-909 running)
SAN-806 Bug

Unused Inputs: Access by pointer is not recognized as usage

Won't Fix [[GENERAL]]
The rule only looks at uses inside the FB or inside a subsignature of the FB
=> Won't fix
SAN-805 Bug

Unused Variables: False positive for rule

Fixed
SAN-790 Bug

SA0040: False positives for rule about possible division by zero

Fixed
SAN-789 Bug

Static Analysis: False positive SA0041 if value in loop is modified via VAR_IN_OUT

Fixed
SAN-788 Bug

Static Analysis: SA0169 is reported for VAR_IN_OUT

Fixed
SAN-783 Bug

Regex expression for combined types doesn't work

Won't Fix [[GENERAL]]
The regular expressions for each type are applied sequentially on the complete variable name. So each regular expression needs to also accept optionally additional characters at the end for further postix type notations.
Generally the naming conventions are only designed for prefix notations and a general support for postfix notations cannot be introduces as fix for this issue. For this reasons the issue will not be fixed.
SAN-768 Bug

SA0046: Error is reported although check against 0 is present

Won't Fix [[GENERAL]]
Handling all kinds of instance paths correctly is very difficult, we recommend to use help variables for complex paths.
We will try to explain the possibilities and limits of the static analysis better in order to teach the programmer to write code that makes the best use of the static analysis checks.
SAN-757 Epic

(Almost) all rules should be processed in Precompile

Fixed
SAN-750 Bug

CODESYS crashes when editing POU in specific customer project.

Cannot Reproduce Cannot reproduce with SAN 5.0.0.0
SAN-726 Bug

SA0039: Unjustified error reported when accessing element of pointer array via index variable which has been checked for <> 0

Won't Fix [[GENERAL]]
Handling all kinds of instance paths correctly is very difficult, we recommend to use help variables for complex paths.
We will try to explain the possibilities and limits of the static analysis better in order to teach the programmer to write code that makes the best use of the static analysis checks.
SAN-708 Bug

Change default text for rule SA0027

Fixed
SAN-657 Bug

Static Analysis Professional: Change default text for rule SA0027

Fixed
SAN-574 Improvement

Static Analysis: Possibility to check only the selected object in the object tree

Won't Fix [[GENERAL]]
By moving most rules in the static analysis to precompile, the message output now shows the messages of the open editors. By opening a single object, showing SAN messages only for this object is the normal behavior.
SAN-542 Bug

Metric, Comments: The percentage of comments of the SET/GET-properties is wrong

Cannot Reproduce
SAN-513 Bug

Metrics:Percentage of comment - Comments from the declaration part are not taken into account in the evaluation

Won't Fix [[GENERAL]]
The metric is calculated only through the implementation part. In this respect, variable declarations are not code.
SAN-511 Improvement

Batch interface for load and export buttons in the configuration dialog

Fixed [[GENERAL]]
2 new commands in the category "staticanalysis": "storeconfiguration" and "loadconfiguration".
Both commands expect exactly one string with the name of the file to save/to load from.
If an empty string is passed to the commands nothing will be done
SAN-509 Improvement

Rules for Initialisation should be toplevel

Fixed
SAN-504 Bug

SA0031: Not working properly on Properties in Children

Fixed
SAN-498 Bug

SA0103 wrongly reported on atomic access in STRUCTS and ARRAYS

Fixed
SAN-442 Bug

SA0008 is not providing a location information

Fixed
SAN-441 Bug

False Positive: Non-regular assignments

Cannot Reproduce [[GENERAL]]
Cannot reproduce
SAN-430 Bug

In libraries the message pragmas creates the message "SA0003: Empty statement"

Cannot Reproduce
SAN-427 Improvement

Do not show metrics information out of compiled libraries.

Cannot Reproduce [[GENERAL]]
The recent released versions of Static Analysis don't display metrics of POUs of compiled libraries
SAN-415 Bug

Automatic static analysis performance may not be done on code generation

Won't Fix [[GENERAL]]
Executing the SAN on every code generation and stoping processes like login/download/online change is not possible. To straighten out this feature, see the related issue SAN-1206.
SAN-362 Bug

SA0090: Error is reported when using RETURN within IF branch

Fixed [[GENERAL]]
Error text of rule SA0090 is now "POUs shall have a single point of exit"
SAN-358 Bug

Static Analysis Full: PLC30\Static Analysis: Variables declared in Visualization Manager should not be checked (e.g. SA0033, SA0043, NC0014, NC0019 reported for CurrentVisu, VISU_MIN_NUMBER_OF_CLIENTS, VISU_MAX_NUMBER_OF_CLIENTS)

Cannot Reproduce [[GENERAL]]
No longer reproducible with Static Analysis 5 and the bugfix for CDS-87800
SAN-327 Bug

Rename rule #6 from "Concurrent access" to „Write access from several tasks“

Cannot Reproduce StR: Ok
SAN-312 Bug

Naming conventions: Missing possibility to configure naming convention for VAR_INST

Cannot Reproduce [[GENERAL]] StR: Ok
SAN-309 Bug

Rule #2 (empty objects) can't be disabled with analysis pragma

Cannot Reproduce [[GENERAL]]
Cannot reproduce with version 5.0.0.0
SAN-303 Bug

Static Code Analysis, CODESYS in German version: Internal error

Cannot Reproduce [[GENERAL]]
The issue cannot be reproduced with version 4.4.1.0
SAN-302 Improvement

Static Analysis: Rule 100 must be specified in variable so far, it should be possible to specify this in the POU

Cannot Reproduce [[GENERAL]]
Cannot reproduce with version 5.0.0.0
SAN-301 Bug

Static Analysis: The rule 33 has a bug and does not report any rule error

Cannot Reproduce [[GENERAL]]
Cannot reproduce with version 5.0.0.0
SAN-299 Improvement

New Rule: Use of possible not initialized reference

Cannot Reproduce [[GENERAL]]
Cannot reproduce issue with SAN 5.0.0.0
SAN-298 Bug

Static Analysis: wrong message "SA0011 Useless declaration..." appear

Fixed [[GENERAL]]
Only the name of the rule and the error message was renamed. Now the following error is reported: "Useless declaration <dutname>: Struct/Enum with only a single member should not be used". The new name for the rule is "Useless declarations. Struct/Enum with only a single member should not be used"
SAN-289 Bug

Tooltip not closed when the context menu is opened in Standard Metrics view

Cannot Reproduce [[GENERAL]] not reproducable any more. No POU tooltip is shown.
SAN-282 Bug

Static Analysis: False positive "possible null pointer dereference" after OR_ELSE

Cannot Reproduce