How to turn off analysis for specific languages

Hi

We have a C# project, but we have a coulpe of HTML/CSS and SQL files in it. We want to run C# analysis, but not SQL, HTML or CSS analysis. In general, we want to run just C# analysis no matter what kind of new files will emerge in the project. How is this possible? It seems, that the only way is to make my own profiles for every language and turn off all the rules. But will this work if some new rule will be added ot that language? It would be nice to have this kind of profiles (No analysis) for every languge in SonarCloud for general use.

Thank you, Stano

1 Like

Hi,

No, it won’t work. Currently the only way to disable a language is to exclude the files of that language from the analysis.

You can find more information about exclusion here.

Hope that helps,

Benoit

Hi again,

It seems I answer a bit quickly. There’s actually two other ways to “disable” a language:

  • Creating another Quality Profile by coping the build-in one (instead of extending it) and disabling all rules.
  • Changing the file suffixes associated to a language to something invalid. For instance you could set the file extension for sql to .foobar. Because none of your SQL file will have a .foobar file suffixes, they won’t be analyzed. You can change this settings from your project dashboard > General Settings > Languages > File suffixes.
2 Likes

We have more than 600 projects you can imagine how painful it can be to go through all of those projects…
is there a way to make it at the organization level? if no do you plan to have such feature in a future release?

Hi,
You can do it for all projects from: administration > Configuration > Languages > choose the language then change/remove the extensions related to it