|
| 1 | += Plugin API Deprecation Policy |
| 2 | + |
| 3 | +== Goal |
| 4 | + |
| 5 | +The goal of the deprecation strategy is to **give the opportunity for plugins to adapt to breaking API changes, while not blocking the evolution of our platforms that implement the API**. |
| 6 | + |
| 7 | +The Plugin API is implemented, at least partially, by 3 platforms: SonarCloud, SonarLint and SonarQube. This introduces a few constraints: |
| 8 | + |
| 9 | +* SonarQube’s own deprecation policy states that breaking changes should only happen in the first releases of a new SonarQube major version (10.0, 11.0, etc). As a result, plugins should be able to be compatible with all versions within a major version; |
| 10 | + |
| 11 | +* SonarLint’s connected mode must be compatible with SonarQube LTS+ and with the previous LTS for 12 months, in the connected mode. As a result, it must be able to run plugins that were designed for those versions, and are potentially up to 1.5 years old; |
| 12 | + |
| 13 | +== Deprecation Process |
| 14 | + |
| 15 | +A Jira ticket should be created with the details, including the reasoning for the deprecation. |
| 16 | + |
| 17 | +Code is deprecated with the annotation `@java.lang.Deprecated`. The API version when the deprecation started should be in the corresponding javadoc. The javadoc needs to indicate what is the replacement, if there is one. |
| 18 | + |
| 19 | +Deprecated API is included in the release notes, which can be found [here](https://github.com/SonarSource/sonar-plugin-api/releases). |
| 20 | + |
| 21 | +The **deprecation can only happen when there’s already a replacement** or when the feature will be completely dropped. |
| 22 | + |
| 23 | +== Dropping APIs |
| 24 | + |
| 25 | +=== When |
| 26 | + |
| 27 | +All breaking changes must be preceded by a **deprecation period of at least 2 years after the deprecation**. This gives time for everyone to adapt, and allows SonarLint to run, in connected mode, plugins that were designed for the current SonarQube LTS. |
| 28 | + |
| 29 | +Plugins that don’t use deprecated APIs in a SonarQube LTS will be compatible with the next major version of SonarQube. |
| 30 | + |
| 31 | +== How |
| 32 | + |
| 33 | +* **Change major version of the API** when we have a breaking change |
| 34 | + |
| 35 | +* **SonarQube should adopt breaking changes before SonarCloud**. This is safer because plugins typically run ITs against SonarQube |
| 36 | + |
| 37 | +**Ask for a PR review**. One of the points to check is whether it’s safe to go ahead with the change and no internal plugins will be broken. |
| 38 | + |
| 39 | +== Exceptions |
| 40 | + |
| 41 | +* Any API (class/interface/method/…) that is annotated with the `@org.sonar.api.Beta` annotation **can be removed at any time without prior notice**. The 2 years deprecation period does not apply in this case. |
0 commit comments