Sonar Scanner not picking up cobol files for scanning

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) * Enterprise Edition Version 8.9.6 (build 50800), sonar-scanner-4.4.0.2170-windows
  • what are you trying to achieve trying to run SonarQube analysis on Mainframe COBOL files
  • what have you tried so far to achieve this tried to clone code from endevor and then run sonar scanner step on the same, its able to index the files

13:49:27 INFO: 234 files indexed 13:49:27 INFO: 0 files ignored because of inclusion/exclusion patterns

but the goes for 0 file to be analysed
13:49:36 INFO: Sensor Embedded CSS Analyzer Sensor [css] 13:49:36 INFO: 0 source files to be analyzed

and atlast gets completed as success.

13:49:36 INFO: 0/0 source files have been analyzed 13:49:36 INFO: CPD Executor Calculating CPD for 0 files 13:49:36 INFO: CPD Executor CPD calculation finished (done) | time=0ms 13:49:36 INFO: Load New Code definition 13:49:36 INFO: Load New Code definition (done) | time=11ms 13:49:36 INFO: Analysis report generated in 249ms, dir size=188 KB 13:49:36 INFO: Analysis report compressed in 49ms, zip size=27 KB 13:49:36 INFO: Analysis report uploaded in 43ms 13:49:36 INFO: ANALYSIS SUCCESSFUL

On SonarQube Project Dashboard we see

The main branch has no lines of code.

Hi @anurag.sharma1,

Could you please share full scan logs with debug i.e., Re-run SonarScanner using the -X switch to enable full debug logging.

Thanks
Srikanth Vangari | SonarSource

looks like I have found the answer, suffix .cbl was not defined for cobol language in SonarQube.

Hi @anurag.sharma1,

I have analysed logs and all files (234 files) with suffixes .CBL are indexed with no language. This happens when .CBL is not specified on sonar.cobol.file.suffixes .

You need add comma-separated list of suffixes to sonar-project.properties file

sonar.cobol.file.suffixes=CBL
sonar.cobol.copy.suffixes=CBL

Refer to Documentation on COBOL

Let me know If you have additional issues.

Thanks
Srikanth Vangari | SonarSource

Thanks Srikath, I have defined it in SonarQube Cobol Language itself so that it will reflect in all future projects as well.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.