sonar-openedge icon indicating copy to clipboard operation
sonar-openedge copied to clipboard

MethodHasTooManyParameters rule suppress issue directive

Open maelstraggiotti opened this issue 10 months ago • 6 comments

Hi,

The MethodHasTooManyParameters rule has no suppress issue preprocessor directive, at least in the documentation.

Thanks

maelstraggiotti avatar Apr 19 '24 14:04 maelstraggiotti

It's {&_proparse_ prolint-nowarn(num_parameters)}. Documentation will be updated.

gquerret avatar Apr 19 '24 14:04 gquerret

Documentation updated.

gquerret avatar Apr 19 '24 14:04 gquerret

Hello,

I reopen the issue because the suppress is not working for procedures, or maybe I did it incorrectly ?

I tried to add it at the very beginning of the file, at the beginning of the file just after the BLOCK-LEVEL..., just before the first parameter, just before the first "incorrect" parameter

PS : Our rule is modified and the limit is 14 parameters

Example:

{&_proparse_ prolint-nowarn(num_parameters)} /* Legacy code */

DEF INPUT PARAMETER PiMode AS I NO-UNDO.        
DEF INPUT PARAMETER PiOrigine AS I NO-UNDO.     
DEF INPUT PARAMETER PiDossier AS I NO-UNDO.
DEF INPUT PARAMETER PiDateArret AS DA NO-UNDO.  
DEF INPUT PARAMETER Piseance AS I NO-UNDO.
DEF INPUT PARAMETER PiFrm AS C NO-UNDO.
DEF INPUT PARAMETER PiCide AS I NO-UNDO.
DEF INPUT PARAMETER Piparam1 AS I NO-UNDO.
DEF INPUT PARAMETER Piparam2 AS C NO-UNDO.      
DEF INPUT PARAMETER Piparam3 AS C NO-UNDO.      
DEF INPUT PARAMETER Piparam4 AS C NO-UNDO.      
DEF INPUT PARAMETER Piparam5 AS C NO-UNDO.      
DEF INPUT PARAMETER Piparam6 AS C NO-UNDO.      
DEF INPUT PARAMETER Piparam7 AS C NO-UNDO.      
DEF INPUT PARAMETER Piparam8 AS C NO-UNDO.      

bmtheo avatar Apr 22 '24 06:04 bmtheo

The preprocessor directive has to be before the PROCEDURE statement

gquerret avatar Apr 22 '24 06:04 gquerret

I meant the file procedure when the parameters are inside the .p file without PROCEDURE statement

bmtheo avatar Apr 22 '24 06:04 bmtheo

Case doesn't seem to be handled correctly. I'll have a look and provide details. If a fix is needed, it will be included in 2.27 as 2.26 is already on its way to GitHub.

gquerret avatar Apr 22 '24 06:04 gquerret

Fixed in develop. Preprocessor statement has to be before the first define parameter statement.

gquerret avatar Jun 25 '24 09:06 gquerret