Sensor Apex Sensor [sonarapex]: Error parsing Salesforce classes

  • 7.9.4
  • what are you trying to achieve: parse apex code
  • what have you tried so far to achieve this: modifying the code

I am getting an inconsistent error when the system tries to parse Apex code. I am not familiar with SonarQube, but I am witnessing an issue where it say “UnexpectedToken” at the first word on the first line on the class. If I change it, it continues. This happens inconsistently, though, and on files that have not been changed for years. And it does it when I update the file to match a class that was able to be parsed. Any ideas what I can do? Thanks.

ERROR: Unable to parse file: file:///C:/bamboo-home/xml-data/build-dir/12/JOB/sfdc/force-app/main/default/classes/AccountControl.cls. Parse error at position 1:0
ERROR: Cannot parse ‘force-app/main/default/classes/AccountControl.cls’: ParseException: Syntax(error = UnexpectedToken(loc = (1, 1, 0, 6), token = ‘public’))

Hi,

Welcome to the community!

Could you provide a sample of the unparsable code?

 
Ann