Monorepositories and LOC

Hi!

We have a monorepository - how does LOC count there? The repository is quite large with multiple web apps in, and we think that it would be best to separate them, but if every LOC in the shared projects are counted multiple times it’s not worth it.

And also, can you analyze TypeScript files? A large amount of our front end is angular with typescript.

Best regards
Oskar

Hey there.

When analyzing a monorepo (and splitting the repo into multiple SonarCloud projects), you can set the analysis scope to narrow the focus to a specific app, or to make sure a shared project is scanned separately. While here, I won’t forget to link to the documentation on monorepos

Typescript is supported out of the box.

Hi! Thank you for your reply.

You didn’t answer my question about how LOC’s are counted in monorepositories.

Since none of our typescript files are scanned I would say that it’s not out of the box. What do we need to do in order to get them scanned? We are using MSBuild to build or project.

Best regards
Oskar

Hey there.

Sorry if I wasn’t clear enough.

If a Line of Code shows up in a SonarCloud project – it will be counted against your license limit. There’s deduplication effort going on behind the scenes when the same lines/files are analyzed in multiple projects.

Therefore, it’s important that for the various projects that make up your monorepo, you’ve adjusted the analysis scope so that the same files aren’t analyzed twice.

It’s hard to say without more details, but unless you see some errors about typescript analysis in your logs, there’s a good chance you need to follow the advice under the documentation for Scanner for .NET > Advanced Topics > Analyzing languages other than C# and VB