SonarQube COBOL Parse Error - How to define source code format in plugin properties?

  • SonarQube 9.1 Enterprise
  • SonarScanner
  • Receiving parse errors for COBOL file in windows-1252 charset
  • Tried to set the COBOL source format to ‘variable’ through properties
  • Tried reviewing documentation, github sources and examples
  • Tried some “obvious” property names:
  1. sonar.cobol.format=variable
  2. sonar.cobol.file.format=variable
  3. sonar.cobol.fileFormat=variable
  4. sonar.cobol.sourceCodeFormat=variable
  5. sonar.cobol.file.sourceCodeFormat=variable

We are receiving parse errors for a set of COBOL sources in various dialects, e.g. ibm-os/vs-cobol

INFO: About to analyse COBOL Programs using 'ibm-os/vs-cobol' dialect and 'fixed' source code format.
DEBUG: 'FILE.cbl' generated metadata with charset 'windows-1252'
ERROR: Unable to parse COBOL source file : D:\Jenkins\workspace\FILE.cbl at line 33

Original contents starting from...

Preprocessed contents:
Parse error at line 33:

We are trying to determine if the parse error is due to the charset, the COBOL dialect, or because we need to define the source code format to be ‘variable’. However, I do not have access to the SonarQube instance to change the format through the GUI. I cannot find any information on how to define the format via properties, such as how sonar.cobol.dialect can be defined.

If it’s possible to set the COBOL dialect via properties, should we be able to set the source code format as well?

This documentation mentions the supported formats but gives no indication of a way to set it at runtime:

This documentation mentions a couple COBOL properties, but doesn’t even mention sonar.cobol.dialect:

And this documentation doesn’t have much information at all about all the supported runtime properties:

Any help would be appreciated. Thanks!

Hello Chris

Did you solve your issue because I have the same error

Best regards

Hey all.

You’re looking for sonar.cobol.sourceFormat. The setting key can be found when browsing settings in the UI.

Hello Colin

Yes I have this param as you can see below

Hi @RedGoldPhoenix ,

I believe that the original question of this thread was answered.

If you need help with a COBOL parsing error, the best course of action would be to create a new thread tagged with “cobol” and, most importantly, to include the COBOL code where the parsing error is raised. Analysis parameters would also help.