How do I add a global suppression file for SonarCloud warnings in Java 11 maven project

I’d like to suppress KEY = java:S2699 but want to do this by adding a global suppressions file to my Java 11 maven project rather than :

  1. tracking in the online sonarcloud UI
  2. having to add the suppression to each and every code file
    I want to do this so that I can track changes as part of my source control in a single global place in my project.

Is there a way to add a suppressions file to my project and have sonarcloud use it when applying analysis to my code.

Hi christian,

Welcome to the Community Support!

You can’t do it by the mean you described.

As a gentle remainder: before you deactivate anything it’s a good practice to check the description of the rule to be sure it won’t have any bad impacts on you software.

Now, you can do it like this in the SonarCloud UI:

  • go to your organisation : you should see many tabs underneath the name of the org (Projects, Issues, …)
  • click on Quality profiles
  • in the filter profile, select Java
  • one profile should be displayed
  • click on the wheel to copy the profile
  • click on code smell in the left panel
  • use the filter with the value java:S2699, you should get the following rendering

  • deactivate the rule