SonarPLI scanner execution Failure

Hi,

I am using Sonar

SonarScanner 4.3.0.2102
SonarQube server 7.9.1

and try to implement a mainframe CI/CD pipeline using jenkins.
Many of our sonar scans fail with :

08:39:14.610 ERROR: Unable to parse file: AMOD/pli/OSB1000.pli
08:39:14.611 ERROR: Parse error at line 968 column 28:

958:             !!trim(char(buff.staRemB))
959:             !!' '
960:             !!'SREC:'
961:             !!trim(char(buff.staRepC))
962:             !!' '
963:             !!'SREB:'
964:             !!trim(char(buff.staRepB))
965:             );
966: 
967: return(0);
968: end #osb1_print_statistics;
                                                 ^
08:39:14.658 INFO: ------------------------------------------------------------------------
08:39:14.658 INFO: EXECUTION FAILURE
08:39:14.659 INFO: ------------------------------------------------------------------------
08:39:14.659 INFO: Total time: 18.277s
08:39:14.757 INFO: Final Memory: 30M/110M
08:39:14.757 INFO: ------------------------------------------------------------------------
08:39:14.757 ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: 968 is not a valid line for pointer. File AMOD/pli/OSB1000.pli has 952 line(s)

What i observerd so far is that all of the sources that lead to a scanner failure do use the PL/I package pattern.

Such as :

OSB1000: package exports            
        ( OSB1000                   
        ,#osb1_create_buffer        
        ,#osb1_copy_buffer          
        ,#osb1_discard_buffer       
        ,#osb1_increase_buffer      
        ,#osb1_add_to_buffer        
        ,#osb1_remove_from_buffer   
        ,#osb1_rep_in_buffer        
        ,#osb1_put_buffer           
        ,#osb1_put_buffer_base64    
        ,#osb1_print_statistics     
        );                          

PL/I packages to allow to write multiple level 1 procedures in a member. Is that supported by the sonar parser?

regards, Marcel

Hello Marcel,
Thank you for raising this to us.
Could you please check what version of SonarPLI you have on your instance ?
If this is the latest, could you please provide a code snippet with which we could reproduce the issue ?
Alex.

Hi Alexandre,

That is SonarPLI 1.10.0.1880 (pli)

A boiled down snippet that compiles but fails parsing is :

START ==============================================

 SONTEST: package exports                                               
         ( SONTEST                                                      
          ,OSH1PRP                                                      
         );                                                                                                                                   
                                                                          
 SONTEST:proc();                                                        
 end SONTEST;                                                           
                                                                       
 OSH1PRP: proc;                                                         
                                                                       
 put skip list('in parse parm');                                        
                                                                       
 end OSH1PRP;                                                           

END ================================================

One further question, i am also feeding UnitTest results (generic execution format), CodeCoverage and external issues (generic issues json format). If the parser fails all this data is not available in sonar as well. Is there a way to ignore paser failures and still use the externally fed data?

Thanks, Marcel

I realized that PL/I adds an implicit end for the package statement if not present. So if i add an
end SONTEST;
at the end the scanner passes.

If I understand correctly the IBM documentation on the package statement, the END keyword is mandatory.

A parsing error should not fail the analysis: you should see all the results of the analysis.
You don’t get any result if the analysis crashes, and the first logs you posted end with such a failure:

I cannot reproduce this error with the PL/I code you shared. Can you please share a reproducer for this error?
Thanks.