Riverside-Software / sonar-openedge

CABL (Code Analyzer for ABL in SonarQube) - ABL ANTLR4 Parser
https://riverside-software.fr
GNU Lesser General Public License v3.0
63 stars 25 forks source link

Conversion from DECIMAL to INT can overflow: not reported in PDSOE when decimal returned from METHOD #1102

Open stefandrissen opened 11 months ago

stefandrissen commented 11 months ago

I thought I had cleaned up everything in PDSOE only to find that there were still issues according to SonarQube server.

CLASS foo:

   METHOD DECIMAL bar ( i_c AS CHARACTER ):
      RETURN DECIMAL( i_c ).
   END METHOD.

   METHOD VOID nowarning ():

      DEFINE VARIABLE i AS INTEGER NO-UNDO.

      i = bar( '123':u ). // no warning in PDSOE, only in SonarQube server
      i = DECIMAL( '123':u ). // warning in PDSOE

   END METHOD.

END CLASS.

image

The source issue on the server: image

gquerret commented 9 months ago

Should be fixed with SonarLint 7.13 or 9.1. Could you check in your environment ?

stefandrissen commented 9 months ago

Updated to 9.1.2906 - still an issue:

image

gquerret commented 9 months ago

Could this be related to this issue: https://github.com/Riverside-Software/sonar-openedge/issues/1105 ? Do you see the issue intermittently ?

stefandrissen commented 9 months ago

The tiny file above reproduces the issue, #1105 seems to be related to larger files?

gquerret commented 9 months ago

It's in fact not directly related to the size of the file.

stefandrissen commented 9 months ago

I now see that #1105 is marked as fixed in 9.1.2912 - the latest release, which I am using, is 9.1.2906.

gquerret commented 9 months ago

9.1.2906 generates .sonarlint/rcc.txt with the list of known classes, and passes a property to SonarLint with this filename. However, that was dependant on the status of the PDSOE code model. In 9.1.2912, the property is always passed, even when the code model is not available when starting SonarLint.

So if you never the issue, check that rcc.txt contains your classname. You can delete the file, it will be regenerated. If this issue is reported intermittently, then upgrade to 9.1.2912 (I'll send a link soon).