Sonar Cloud Analysis takes over 40 min and sometimes stuck for 2 hours

Hello,

I have a NX Monorepo of a few React Apps.

I setup Sonarcloud to maintain some quality across all projects, but I face some issue with the Analysis.

First of all, it’s super unclear to me how to activate the mono repository option, and how does it works.
I saw a button in project setting > General > Enable Support for MonoRepo, that I turned on, but then what ? How does it know what changed, what to analyze, etc…

Second, probably my setup is a bit incorrect because of the above, but sometimes it just take over 2 hours to analysis some small PR with very few changes, and 7min to analyze bigger one… so I am kind of confused by it. THe result of those analysis is correct, but the way it is performed is making our CI usage so high.
it finish those run with like INFO: Miss the cache for 1846 out of 1846: FILE_CHANGED [28/1846], FILE_NOT_IN_CACHE [1818/1846] maybe something related idk

Is there a clear guide on what to do ? is there a cli to run some command on some files manually so I can control the logic of the file checked ?

Thank you

Hi,

Welcome to the community!

We try to keep it to one question per thread. Otherwise, it gets messy, fast. I’m going to focus on the second question but for the first, have you seen the monorepo docs?

I suppose analysis is automated? Which means it’s run the same way each time?

Can you share the log of a long-running analysis?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hi, Thanks for the reply.

I see the doc improved on monorepo setup, so I tried to applied the changes needed but I think the ‘monorepo’ in sonarcloud is not exactly working as expected.

I am using a NX monorepo with 3 projects and multiple libs that are used in those 3 projects. I would like to run the sonarcloud scan only on files that changes or that are ““affected”” by the PR. Since this is probably not possible I think I need to consider my monorepo as a normal single project and run the scan over everything.

Or else I should consider it 3 project, and add all the library in one of those project…

I am resetting up everything from scratch and I will check.

I have a few questions, but if I have to add a post per question like you suggest, it would not be really helpfull without the context. Is there some help service or some way I could ask a bunch of question and getting some help other than this community forum ?

Hi,

Each thread will need to include the relevant context, but you can certainly cross-reference threads…

 
Ann