How to fix deprecated rules

Dear Support,

I recently visited Quality Profiles and realised some deprecated rules. Is there any action needed from the administrator to address these?


The documentation says:

Deprecated : The rule should no longer be used because a similar, but more powerful and accurate rule exists.

But nothing regarding how to replace rules.

I did a bit of research and found some questions regarding specific rules, e.g. here

There’s a topic in Stackoverflow: SonarQube 6.4, deprecated rules and how to fix them

I see javascript:S4787 rule as deprecated.
Following the advise above, what would happen if I click the Activate button?



Rules are marked as deprecated when we no longer believe in the value provided by the rule or when some rules are re-organized (case of merge or split of rules). Generally the rule is replaced by a new one and the replacement rule is documented in the deprecated rule’s description.

The built-in “Sonar way” Quality Profile is automatically updated for you: deprecated rules are removed and new rules are activated on it.

For your custom Quality Profiles, you should do the same manually:

  • remove the deprecated rules from them
  • decided if you want to use the new rules



Thank you for the response.

Sorry, it’s still a bit unclear to me in two areas:

  1. “Sonar way” Quality Profile is automatically updated for you
  2. How do I know which rules should I enable in place of deprecated ones?

[1] In the screenshot attached above, I see “Sonar way” quality profile with deprecated rules. What is the timeframe for these rules to be replaced? I feel anxious about seeing a big red box sitting in Quality Profiles.

[2] Let’s discuss a specific rule an example, i.e. javascript:S4787. How do I know which rules should I enable to compensate the deprecated one?


Hi @Alexandre_Gigleux,

I’m circulating back as I did not hear from you.
I’m aware my previous response was 6 days delayed, but I got distracted with something.
Could we continue this thread?



The rule javascript:S4787 is as of now not deprecated but if it was the case then you would see at the end of the rule’s description a “Deprecated” section. This section explains which rule should be used as a replacement if any exists.

For the case of S4787 for Java, it’s written this:

## Deprecated
This rule is deprecated, and will eventually be removed.

It means you are informed that we no longer believe in this rule and but there is no replacement yet.

For some other rules there is an explanation of which rule to activate as a replacement: