ParseErrors and java.lang.UnsupportedOperationException Errors

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • We are using SQ version 8.9 and Using plugins CodeScan 4.5.6.1 and CodeScan Lang 4.5.6.1
  • what are you trying to achieve
  • We have integrated with out github repo’s and running it in the pipelines for the PR’s to run static analysis
  • what have you tried so far to achieve this
  • We have tried downgrading the CodeScan and CodeLang versions but still getting the errors

Issues Faced

  • We are getting parse errors in the pipeline and we need help to figure out the cause of those - errors are below:
# Error 1
INFO: Sensor CodeScan parser [codescan]

954ERROR: error while parsing file 'sfdx/node_modules/@salesforce/templates/lib/templates/apexclass/DefaultApexClass.cls'

955com.villagechief.pmd.lang.apex.ast.ParseException: Encountered " "<" "< "" at line 1, column 27.

956Was expecting:

957 <IDENTIFIER> ...

958

959 at com.villagechief.pmd.lang.apex.ast.ApexParser.generateParseException(ApexParser.java:10140)

960 at com.villagechief.pmd.lang.apex.ast.ApexParser.jj_consume_token(ApexParser.java:10024)
# Error 2

ERROR: Parse error at line 7 column 3:

1283

1284 1: // @flow

1285 2:

1286 3: declare module.exports: (

1287 4: dateLeft: Date | string | number,

1288 5: dateRight: Date | string | number

1289 6: ) => number

1290 --> EOF
# Error 3
ERROR: Error during SonarScanner execution
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.process(CFamilySensor.java:208)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Need Urgent Help on this please

Hi,

Welcome to the community!

We try to keep it to one question per thread. Otherwise things get messy.

It seems that your first error is caused by your CodeScan plugin. You’ll need to reach out to them for that.

For the second error, I can’t tell but I’m guessing it’s the same.

For the third error, it seems that your project includes C, C++ or Objective-C files but you haven’t followed the correct procedures to analyze those files.

 
HTH,
Ann

Hi Ann,

Thank you for the response.

How can I reach out to codescan for the issue - is there any way or link to check with them ?

Thanks

Hi,

This is a 3rd-party commercial product. Perhaps their sales rep can point you in the right direction.

 
:slightly_smiling_face:
Ann