Indexing of files takes a lot of time in Node.js project when switching from NPM to PNPM

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension):

    Sonarqube Developer 9.7.1.62043

  • what are you trying to achieve

    I migrated a project from npm to pnpm and now the time it takes to scan it on Azure DevOps has increased considerably. When I look in the logs it is taking 5 minutes to index the files

2022-11-07T18:12:04.6296846Z INFO: Load project repositories
2022-11-07T18:12:05.2570805Z INFO: Load project repositories (done) | time=625ms
2022-11-07T18:12:05.2885874Z INFO: Indexing files...
2022-11-07T18:12:05.2892307Z INFO: Project configuration:
2022-11-07T18:12:05.2893349Z INFO:   Excluded sources: **/src/assets/*
2022-11-07T18:12:15.2895034Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:12:25.2899439Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:12:35.2905074Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:12:45.3059702Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:12:55.3170142Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:13:05.3181383Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:13:15.3190367Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:13:25.3210662Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:13:35.3220030Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:13:45.3228841Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:13:55.3343130Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:14:05.3494439Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:14:15.3504478Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:14:25.3506723Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:14:35.3659128Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:14:45.3814582Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:14:55.3925295Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:15:05.3941776Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:15:15.3959639Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:15:25.3960344Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:15:35.4112840Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:15:45.4121500Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:15:55.4233747Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:16:05.4384375Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:16:15.4538952Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:16:25.4556884Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:16:35.4575537Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:16:45.4585088Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:16:55.4696134Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:17:05.4850653Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:17:15.5007762Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:17:25.5023222Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-07T18:17:26.1640327Z INFO: 655 files indexed
2022-11-07T18:17:26.1640960Z INFO: 0 files ignored because of inclusion/exclusion patterns
2022-11-07T18:17:26.1641383Z INFO: 510723 files ignored because of scm ignore settings

If I build the old branch that had NPM on it this steps takes just a few seconds

2022-11-08T14:33:32.2050590Z INFO: Auto-configuring with CI 'Azure DevOps'
2022-11-08T14:33:32.2113698Z INFO: Load quality profiles
2022-11-08T14:33:32.3606044Z INFO: Load quality profiles (done) | time=156ms
2022-11-08T14:33:32.3775847Z INFO: Load active rules
2022-11-08T14:33:39.4755481Z INFO: Load active rules (done) | time=7095ms
2022-11-08T14:33:39.4845543Z INFO: Load analysis cache
2022-11-08T14:33:39.5706125Z INFO: Load analysis cache | time=78ms
2022-11-08T14:33:39.6309797Z INFO: Branch name: feature/108956-UpdateToNode16
2022-11-08T14:33:39.6498135Z INFO: Load project repositories
2022-11-08T14:33:40.1567716Z INFO: Load project repositories (done) | time=516ms
2022-11-08T14:33:40.2128038Z INFO: Indexing files...
2022-11-08T14:33:40.2129229Z INFO: Project configuration:
2022-11-08T14:33:50.2142150Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-08T14:34:00.2151834Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-08T14:34:10.2173859Z INFO: 19 files indexed...  (last one was deploy.yaml)
2022-11-08T14:34:13.3652185Z INFO: 654 files indexed
2022-11-08T14:34:13.3654661Z INFO: 75876 files ignored because of scm ignore settings
  • what have you tried so far to achieve this

I upgrade from 9.6 to 9.7 as I read here that it had better performance for TypeScript.

Hey there.

How does the performance improve if you set an explicit exclusion for the node_modules folder?