Some JS files not being analyzed

Must-share information (formatted with Markdown):

  • Sonarqube 8.9.10
  • how is SonarQube deployed: zip
  • Scanning multiple files in a folder

So I am scanning a folder containing multiple files and subfolders, and I get the following message. The scan at the end is successful, but it just misses some JS files due to some syntax issues. Other JS files are scanned with no problem.

ERROR: Failed to parse file [nftx-protocol-v2/scripts/upgrade.js] at line 33: unknown: Unexpected token (33:0)

  31 |     process.exit(1);
  32 |   });
> 33 |
     | ^
INFO: 48/488 files analyzed, current file: DeFi-Pulse-Adapters/projects/bancor/index.js
INFO: 117/488 files analyzed, current file: accounting/stakingData.js
ERROR: Failed to parse file [nftx-protocol-v2/scripts/retrieve-tokens-upgrade.js] at line 41: unknown: Unexpected token, expected "${" (41:1)

  39 |     process.exit(1);
  40 |   });
> 41 | `
     |  ^
INFO: 214/488 files analyzed, current file: DeFi-Pulse-Adapters/projects/set-protocol/index.js
INFO: 289/488 files analyzed, current file: nftx-protocol-v2/scripts/ropsten/1-deploy.js
INFO: 354/488 files analyzed, current file: x-contracts-private/test/mainnet_v2_upgrade-test.js
INFO: 375/488 files analyzed, current file: nftx-protocol-v2/scripts/deploy.js

Any idea why might this be?

Hey there.

First things first – try upgrading to SonarQube v9.9 LTS and see if the problem remains.

You may find the Upgrade Guide and the LTS to LTS release upgrade notes for 8.9 to 9.9 helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.

So I have upgraded, I am now on

  • Community Edition
  • Version 10.0 (build 68432)

Still get these errors:

[2023-04-12T04:00:44.733+0000] {subprocess.py:93} INFO - ERROR: Unable to parse file: casper/casper/contracts/msg_hash.se.py
[2023-04-12T04:00:44.733+0000] {subprocess.py:93} INFO - ERROR: Parse error at line 2 column 6:
[2023-04-12T04:00:44.733+0000] {subprocess.py:93} INFO - 
[2023-04-12T04:00:44.733+0000] {subprocess.py:93} INFO -   -->  macro calldatachar($x):
[2023-04-12T04:00:44.734+0000] {subprocess.py:93} INFO -     3:     div(calldataload($x), 2**248)
[2023-04-12T04:00:44.734+0000] {subprocess.py:93} INFO -     4:
[2023-04-12T04:00:44.734+0000] {subprocess.py:93} INFO -     5:
[2023-04-12T04:00:44.734+0000] {subprocess.py:93} INFO -     6:
[2023-04-12T04:00:44.734+0000] {subprocess.py:93} INFO -     7: macro calldatabytes_as_int($x, $b
[2023-04-12T04:00:44.734+0000] {subprocess.py:93} INFO - 
[2023-04-12T04:00:50.349+0000] {subprocess.py:93} INFO - INFO: 1952/3001 files analyzed, current file: qemu/scripts/modules/module_block.py
[2023-04-12T04:00:59.324+0000] {subprocess.py:93} INFO - ERROR: Unable to parse file: casper/casper/contracts/sqrt.se.py
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO - ERROR: Parse error at line 1 column 9:
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO - 
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO -   -->  with inp = ~calldataload(0):
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO -     2:     foo = inp
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO -     3:     exp = 0
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO -     4:     while foo >= 256:
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO -     5:         foo = ~div(foo
[2023-04-12T04:00:59.325+0000] {subprocess.py:93} INFO - 
[2023-04-12T04:01:00.349+0000] {subprocess.py:93} INFO - INFO: 2197/3001 files analyzed, current file: tvm/tests/python/unittest/test_lang_verify_compute.py
[2023-04-12T04:01:10.349+0000] {subprocess.py:93} INFO - INFO: 2314/3001 files analyzed, current file: tvm-cvm/python/tvm/relay/grammar/__init__.py
[2023-04-12T04:01:20.350+0000] {subprocess.py:93} INFO - INFO: 2520/3001 files analyzed, current file: cvm-runtime/python/mrt/sym_calib.py
[2023-04-12T04:01:25.353+0000] {subprocess.py:93} INFO - ERROR: Unable to parse file: tvm-cvm/tutorials/mnist/int_layer.py
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO - ERROR: Parse error at line 21 column 0:
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO - 
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO -    15: ._num_
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO -    16:
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO -    17:     def forward(self, x):
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO -    18:         ctx = x.context
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO -    19:         return mx.symbol.Custom(x, self
[2023-04-12T04:01:25.354+0000] {subprocess.py:93} INFO -    20:
[2023-04-12T04:01:25.355+0000] {subprocess.py:93} INFO -   -->  EOF

Well, it looks like your Javascript files aren’t having parsing errors anymore :smiley: That’s a step in the right direction.

It would be helpful if you could upload copies of the files that failed to parse so we can see if it’s an issue we should address in our analyzer.

Hmm, I will try and do that on Monday, but might be a bit difficult since I am analyzing repos and deleting them.