Unable to parse file: file:///D:/a/1/s/*.scala. Parse error at position 17:0
2019-09-12T07:45:07.0415130Z ##[error]
Description
Here, I am trying to scan notebooks which is created for Azure Data bricks and noticed that I have below code added for given line number for different notebooks.
dbutils.widgets.text(“key”,“value”
val variableName = “value”
Do we have support to run the SonarQube scan for Azure Databricks Runbook? If yes, please let me know to fix above issue.
If I understand correctly, the two lines mentioned are automatically added to some of your Scala files, preventing them from being correctly analysed, is it correct?
To me, the error is correct, the first line is not valid Scala code and can not be correctly parsed, did I miss something?
In addition, the analysis fail due to this error?
If it is the case, this ticket seems to fix this issue, it will be available at the next release of SonarScala.
In order to help you, I need to know precisely the part of the code causing the failure, can you provide the failing file (here or privately) or, even better, a simple code snippet that you cannot analyse?
I uploaded 2 sample files with both examples and got below error with SonarQube scan.
##[error]ERROR: Unable to parse file: file:///D:/a/1/s/Notebooks/SonarQube/Sample_1.scala. Parse error at position 8:0
##[error]ERROR: Unable to parse file content.
##[error]ERROR: Unable to parse file: file:///D:/a/1/s/Notebooks/SonarQube/Sample_2.scala. Parse error at position 8:0
##[error]ERROR: Unable to parse file content.
(Note: Please remove .txt extension after downloading.)
Thanks for the two reproducers, the problem is clearer now.
The error comes from the fact that the file contains only Scala expressions that are not valid at the top-level for Scala programs. I created a ticket to improve the current situation, we will try to tackle it the next time we work on the plugin.
Finally, one of my concerns was that the analysis would fail due to this error, but it is not the case, so we are fine on this side.
Thank you for recognizing this situation and it seems this issue has been resolved. Does that mean the next release of sonarscanner will have this new feature?
The scanner downloads analyzers from your SonarQube Server, makes sure the analysis happens (spitting out logs along the way), and then sends the analysis to the SonarQube server. Language analysis features ≠ the version of the scanner you’re using.