The noeffect rule should exclude NEXT-VALUE(SomeSequence)

Project:Prolint Issue Tracker
Component:Rules
Category:bug report
Priority:minor
Assigned:jurjen
Status:closed
Description

I found some old code of a programmer that didn't understand how to use sequences.
The code goes like this:
-----------------------
CREATE SomeTable.
SomeTable.UniqueID = CURRENT-VALUE(SomeSequence).
NEXT-VALUE(SomeSequence).
-----------------------

Prolint gives an entry to the "noeffect" rule on the third line ("NEXT-VALUE(SomeSequence).").

Although there should definitively be a rule to find this kind of bad programming, it is in no case a statement without effect: remove this line and you have a big problem. NEXT-VALUE does have an effect even when it is not assigned to some field or variable: it increments the sequence's current-value (the next call to CURRENT-VALUE will have a different value - and that is why this program works, although it is bad programming).


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jurjen's picture

#1

Assigned to:Anonymous» jurjen
Status:active» fixed

Thanks!!!
Fixed and committed in subversion revision 346: rule "noeffect" will not warn about NEXT-VALUE anymore. This bugfix will be shipped with the next Prolint release = surprisingly soon.

You also raised a different topic in this issue, about that you would like a rule that warns about bad usage of NEXT-VALUE. I am not sure what you mean exactly, maybe because I don't use sequences often enough :-( I am closing this issue because of the bugfix, so maybe you want to create a new issue to request the new rule?


#2

Status:fixed» closed