sonar-openedge
sonar-openedge copied to clipboard
Conversion could overflow variable - value XXXX too large to fit in INTEGER
Hi,
The following code snippet is not violating the 'Conversion could overflow variable' rule, although it could lead to runtime errors like value XXXX too large to fit in INTEGER (15747).
DEFINE VARIABLE TheInt AS INT64 NO-UNDO.
DEFINE VARIABLE TheString AS CHARACTER NO-UNDO.
TheString = "123456789123456789":U.
TheInt = INTEGER(TheString).
Could the rule be extended in order to also detect this?
Background information: we are refactoring our application to have INT64's primary id fields in each table (in stead of INTEGER before).
Thank you for any feedback, Dominick
Congratulations for issue #1000 😃 🎆 🎆🎆
Technically, that could also overflow INT64, so it would be difficult to include that directly in the rule. It's not very difficult to have a rule that detects assignment of INT(char) function to INT or INT64, but I'm not sure if that would be really useful, the number of FP would probably be very high.
Change added in develop, will be included in next release.