Version 4.2 introduces a major feature that required deep internal refactoring : support of multiple languages in the same project or sub-project. No new API was developed but it requires some changes on existing plugins. Some usages of API must be replaced. It does not require to upgrade the minimum required version of SonarQube. It can still be 3.7 for example. By following these rules, a plugin should be compatible with SonarQube 3.7+ and should support multi-language feature :
|Implementations of |
FooLanguage -> FooSettings -> Settings
|Language implementations and their dependencies (FooLanguage and FooSettings in the example) must be flagged with |
|Check project language, for example:||Check existence of source files of the given language, for example:|
|Extend ||Use |
|Use source directories :||Replace with:|
|Use constructors of ||Use |
|Check language of Quality profile:||Search for the active rules that relate to your rule repository:|
No alternative before 4.2. Use
Consequence : it's not possible to directly store measures or issues on a directory before 4.2.
|Use sonar-commons-rules 1.1 or lower||Upgrade to sonar-commons-rules 1.2 : provide basic implementations of |
|Use resource scopes PGU (Scopes.PROGRAM_UNIT) and BLU (Scopes.BLOCK_UNIT), associated to classes ||Do not register classes, methods, functions and paragraphs. Keep these concepts internal to your plugin.|
|Use ||Implement your own Cobertura report parser in order to control way to locate files.|
|Java only - Use classes ||Use classes |
- Thanks to multi-language support, several Quality profiles can be enabled for the same project at the same time. Injecting the class
org.sonar.api.profiles.RulesProfilein batch extensions does not make sense anymore. The list of active rules is available through the new class
org.sonar.api.batch.rule.internal.ActiveRulesBuilderfor your unit tests.
- Write CSV, JSON and XML documents without coupling on any third-party library and in a performant way (streaming) :
org.sonar.api.utils.text.XmlWriterFor information the next step is to provide the related readers.
- New class
org.sonar.api.utils.System2. It aims to improve testability of classes that interact with low-level system methods. See example in Javadoc.
- Prototype.js and Scriptaculous.js are deprecated and will be dropped in 4.3. Please replace usages with jQuery. To prevent conflicts, jQuery uses "$j" and Prototype.js uses "$".