Question: 3 - Eclipse(SonarLint,Binding to SonarQube) is not executing COBOL, COPY FILES Files and not providing any recommendations

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

  • SonarQube Enterprise Edition - 7.9.1.27448

  • SonarLint - 4.1

  • Topaz Workbench IDE

  • what are you trying to achieve

  • List item

  • Analyse a mainframe Project (COBOL, COPYBOOKS) from IDE using sonar lint and binding the project in SonarQube and run the analysis to get the issues and recommendations on fly.

  • Scan is working fine from SonarQube from Jenkins, seeing only issue with mainframe projects.

  • Noticed Java projects are being scanned properly and getting the analysis.

  • what have you tried so far to achieve this

Open the project properties and select “SonarLint” and then “Analyzer properties”: I believe you should enter there the settings you put in sonar-project.properties, at least sonar.cobol.file.suffixes.

1 Like

Thank you @pynicolas for getting back to me. I have updated the properties and getting the below errors.

Trigger: MANUAL
Clear markers on 0 excluded files
SonarLint analysis of project example (18 files processed)…
Connected mode (using configuration of ‘SonarQube_MF_xxx_PROD’ in server ‘sonarqube-preprod.xxx.com’)
Starting analysis with configuration:
[
projectKey: SonarQube_MF_xxx_PROD
baseDir: C:\Users\xxx\Desktop\Mainframe\GitLab\example
extraProperties: {sonar.cobol.copy.suffixes=cob,cbl,cpy,copy, sonar.c.file.suffixes=-, sonar.cobol.file.suffixes=cbl,cpy, sonar.objc.file.suffixes=-, sonar.sources=COBOL,COPYBOOK,PLI, sonar.cpp.file.suffixes=-, sonar.pli.file.suffixes=pl1,pli,plm}
inputFiles: [
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/RESOURCES/SAMPLE.CUSTFILE (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/JCL/ALLOCATE.jcl (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/JCL/PLIALLOC.jcl (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/README.md (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/COBOL/SAM1.cbl (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/PLI/PSAM1.pli (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/JCL/RUNPSAM1.jcl (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/COPYBOOK/CUSTCOPY.cpy (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/RESOURCES/SAMPLE.PLI.TRANFILE (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/JCL/RUN.jcl (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/COPYBOOK/TRANREC.cpy (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/INCLUDES/CUSTPLI.inc (UTF-8) [cpp]
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/COBOL/SAM2.cbl (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/RESOURCES/SAMPLE.TRANFILE (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/RESOURCES/SAMPLE.PLI.CUSTFILE (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/PLI/PSAM2.pli (UTF-8)
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/INCLUDES/BALSTATS.inc (UTF-8) [cpp]
file:/C:/Users/xxx/Desktop/Mainframe/GitLab/example/LICENSE (UTF-8)
]
]

Error during execution of SonarLint analysis
java.lang.UnsupportedOperationException:

The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property “sonar.cfamily.build-wrapper-output”, but it was not specified.

If you don’t want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-


at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:116)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:72)
at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:134)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:75)
at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:81)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:152)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:344)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:334)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:149)
at org.sonarlint.eclipse.core.internal.server.Server.runAnalysis(Server.java:327)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeConnectedProjectJob.runAnalysis(AnalyzeConnectedProjectJob.java:72)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeConnectedProjectJob.runAnalysis(AnalyzeConnectedProjectJob.java:1)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.run(AbstractAnalyzeProjectJob.java:399)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.runAnalysisAndUpdateMarkers(AbstractAnalyzeProjectJob.java:207)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.doRun(AbstractAnalyzeProjectJob.java:169)
at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.run(AbstractSonarProjectJob.java:45)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

It seems that there’s a problem with the C/C++ analyzer which I don’t really understand.
I suggest that you exclude files ending with “.inc”: right-click on the file and select “SonarLint” > “Exclude”.

1 Like

Appreciate all the help @pynicolas . Excluded the files with .inc and now i am not seeing any errors and continue with the Scan and it is providing the desired output.

I had similar issue for Cobol copybook(.cpy files), with all the analyzer properties set,sonarlint does not analyze .cpy files

I have posted here with details;