Exception in scanner run

  • Manual scan from command line
  • sonar-scanner-cli-8.0.1.6346-windows-x64
  • OpenJDK Runtime Environment Temurin-21.0.11+10 (build 21.0.11+10-LTS)
  • Languages of the repository: Legacy repo with VB6, C++, Python, …
  • Different file encodings in the repo: ANSI, UTF-8
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    • Exception in scanner
10:38:48.975 ERROR Error: Missed semicolon
10:38:48.975 ERROR     at e.parsingError (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2299:3179)
10:38:48.975 ERROR     at NFg (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:522)
10:38:48.976 ERROR     at PFg (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:48)
10:38:48.976 ERROR     at async hmi (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:402)
10:38:48.976 ERROR     at async _Qe (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:1018)
10:38:48.976 ERROR     at async Lcl (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:16183)
10:38:48.976 ERROR     at async Qcl (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:17824)
10:38:48.976 ERROR     at async d8r (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:24057)
10:38:48.976 ERROR     at async MessagePort.<anonymous> (C:\_Repos\<Reponame>\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2450:31267)
10:38:48.976 ERROR Error: Unterminated string constant. (32:66)

Hi,

How is this different from your other thread?

 
Thx,
Ann

Hi @ganncamp

originally everything was in one post :slight_smile: but for the mixed encodings the scanner didn’t crash. And so I assumed, that it will be two different things to investigate - file ecnodping handling and exception. Therefore the top lines of the stacktrace.

Hi,

Is this a different project? The same project with a different? Additional problem?

What’s the language of the file analysis crashed on? At this point I’m guessing that analysis of a single(?) mixed project emitted (relatively) graceful errors when it failed to parse some of the languages, but there was one language where the parsing failure caused analysis to crash. Is that correct? And if so, what was the language?

 
Thx,
Ann

Hi Ann,

it is the same project. As the ERROR is comming in a line with a folder from SonarD:_1\1\s.scannerwork.sonartmp\bridge-bundle\package\bin\server.cjs:2297:3179 I assume that it is another error. At least I expected that the file in the sonar folder there shouldn’t be a parseing error.

In the whole repo there is no tsconfog.json file as in the log mentioned before the ERROR occurs at 08:58:58.828. The last parse exception in the log from our code is 6 seconds earlier, but I attach that file as zip also.
IWEvent.zip (399 Bytes)

08:58:32.774 ERROR Cannot parse 'entwickl/CommonClasses/IWEvent.cls': ParseException: Syntax(error = UnexpectedToken(loc = (1, 9, 2, 5), token = '1.0'))
08:58:32.775 INFO  330/330 source files have been analyzed
08:58:32.776 INFO  Sensor Apex Sensor [sonarapex] (done) | time=11683ms
08:58:32.777 INFO  Sensor Test coverage Sensor for Apex [sonarapex]
08:58:32.777 INFO  Sensor Test coverage Sensor for Apex [sonarapex] (done) | time=0ms
08:58:32.778 INFO  Sensor JavaScript/TypeScript/CSS analysis [javascript]
08:58:34.226 INFO  Detected os: Windows Server 2022 arch: amd64 alpine: false. Platform: WIN_X64
08:58:34.227 INFO  Deploy location C:\Users\svc-buildtfs\.sonar\js\node-runtime, tagetRuntime: C:\Users\svc-buildtfs\.sonar\js\node-runtime\node.exe,  version: C:\Users\svc-buildtfs\.sonar\js\node-runtime\version.txt
08:58:36.639 INFO  Using embedded Node.js runtime.
08:58:36.639 INFO  Using Node.js executable: 'C:\Users\svc-buildtfs\.sonar\js\node-runtime\node.exe'.
08:58:41.897 INFO  Memory configuration: OS (7410 MB), Node.js (2240 MB).
08:58:41.950 INFO  gRPC analyze-project server listening on 127.0.0.1:63371
08:58:42.636 INFO  Plugin version: [12.5.0.41048]
08:58:53.898 INFO  Found 0 tsconfig.json file(s): []
##[error]08:58:58.828 ERROR Error: Missed semicolon
08:58:58.828 ERROR Error: Missed semicolon
##[error]08:58:58.828 ERROR     at e.parsingError (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2297:3179)
08:58:58.828 ERROR     at cLg (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:522)
08:58:58.828 ERROR     at lLg (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:48)
08:58:58.828 ERROR     at async egi (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:402)
08:58:58.828 ERROR     at async vQe (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:1018)
08:58:58.828 ERROR     at async jul (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:17125)
08:58:58.828 ERROR     at e.parsingError (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2297:3179)
08:58:58.828 ERROR     at cLg (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:522)
08:58:58.828 ERROR     at lLg (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:48)
08:58:58.828 ERROR     at async egi (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:402)
08:58:58.828 ERROR     at async vQe (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:1018)
08:58:58.828 ERROR     at async jul (D:\_1\1\s\.scannerwork\.sonartmp\bridge-bundle\package\bin\server.cjs:2448:17125)

Hi,

Thanks for the log snippet. It seems to implicate the JS/TS scanner, but I’d like a little more evidence. Can you give me a sonar.verbose=true version?

The zip extracts to a single .cls file which… confuses me. Google tells me a cls is a class file, and yes, this file starts with VERSION 1.0 CLASS but I would have expected a binary format…? I guess this is a VB6 file?

 
Thx!
Ann

Hi Ann,

yes, unfortunately VB6 is part of this legacy repo. CRA is coming :frowning: and we will not continue to deliver, as unfortunately not all functionality is replaced by newer products.

CLS file is a class file containing the source code for one class.

JS are only 2 files in the repo from 3rd party projects (boost), TS not at all.

When starting the build with verbose logs, the ERROR Error: Missed semicolon" is not showing up :thinking: Therefore I run it again without verbose and will send you the content of D:_1\1\s.scannerwork as a private message as zip. Maybe that will help you for investigation.

Hi,

Fascinating.

From the full (non-debug) log you sent me, it looks like the parsing errors might be coming from Apex:

So I did some digging in SonarQube Cloud and indeed, the .cls extension is mapped to Apex. The .ctl extension is mapped - by default - to Visual Basic.

And then, the .cjs extension - another source of parsing errors in your log - is mapped to JS/TS. The internet isn’t helping me with what you might be using that extension for, but the number of parsing errors doesn’t match with the number of JS files you claim. :smiley:

Strangely, this log does still show the analysis erroring-out, but with an error from the C++ analyzer, rather than the semicolon error from the initial post. It looks like there are plenty of .h files in the project. Are they actually for C/C++ code? Or maybe that’s another file extension that needs to be re-mapped?

Can you try changing your extensions around in this project and see if that gets you a better - and hopefully error-free - analysis?

 
Thx,
Ann