Skip to content

Commit 0e91b68

Browse files
committed
Upgrade for SonarQube 2025
1 parent f0c7a29 commit 0e91b68

File tree

13 files changed

+452
-448
lines changed

13 files changed

+452
-448
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Here is the compatibility matrix of the plugin:
3838
| 3.1.1 | 4.1.2 | 7.9 -> 9.9 | Fortran |
3939
| 3.1.2 | 5.1.0 | 7.9 -> 9.9 | Fortran |
4040
| 5.1.0 | 5.1.0 | 7.9 -> 9.9 | Fortran |
41+
| 5.2.0 | 5.1.0 | 25.1.0 -> 25.9.0 | Fortran |
4142

4243
*Notice: Since 5.X this plugins will follow I-Code versionning. There is no breaking changes between 3.X and 5.X*
4344

@@ -50,8 +51,8 @@ If embedded version of i-Code does not match your need, you can set the executio
5051
- `sonar.icode.path`: Define i-Code CNES executable path to auto-launch it on analysis. Default: `${HOME}/icode-cnes/icode.exe`.
5152

5253
#### Other plugin's properties
53-
- `sonar.icode.f77.file.suffixes`: List of suffixes for F77 files to analyze. Default: `.f,.f77,.for,.fpp,.ftn,.F,.F77,.FOR,.FPP,.FTN`.
54-
- `sonar.icode.f90.file.suffixes`: List of suffixes for F90 files to analyze. Default: `.f90,.F90`.
54+
- `sonar.f77.file.suffixes`: List of suffixes for F77 files to analyze. Default: `.f,.f77,.for,.fpp,.ftn,.F,.F77,.FOR,.FPP,.FTN`.
55+
- `sonar.f90.file.suffixes`: List of suffixes for F90 files to analyze. Default: `.f90,.F90`.
5556
- `sonar.icode.reports.path`: Path to the i-Code reports. Multiple path can be provided. Default: `result.res`.
5657

5758
### Features

it/Dockerfile-auditor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ COPY --from=builder /opt/sonar-scanner /opt/sonar-scanner
2222

2323

2424
RUN apk update --no-cache && \
25-
apk add --update --no-cache -q curl gcc jq libffi-dev musl-dev openssl-dev python3 py3-requests shellcheck
25+
apk add --update --no-cache -q curl gcc jq libffi-dev musl-dev openssl-dev python3 py3-requests
2626

2727
RUN set -eux && \
2828
addgroup --gid 1000 scanner-cli && \

pom.xml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
<maven.compiler.release>17</maven.compiler.release>
6363
<surefire.version>3.5.3</surefire.version>
6464
<!-- Matrice: https://github.com/SonarSource/sonar-plugin-api -->
65-
<sonar.plugin.api.version>9.14.0.375</sonar.plugin.api.version>
66-
<sonar.version>9.9.0.65466</sonar.version>
65+
<sonar.plugin.api.version>11.0.0.2664</sonar.plugin.api.version>
66+
<sonar.version>25.1.0.102122</sonar.version>
6767
<sonar.pluginKey>icode</sonar.pluginKey>
6868
<sonar.pluginClass>fr.cnes.sonar.plugins.icode.ICodePlugin</sonar.pluginClass>
6969
<sonar.pluginUrl>https://github.com/cnescatlab/sonar-icode-cnes-plugin</sonar.pluginUrl>
@@ -74,15 +74,11 @@
7474
</properties>
7575

7676
<repositories>
77-
<repository>
78-
<id>jitpack.io</id>
79-
<url>https://jitpack.io</url>
80-
</repository>
8177
<repository>
8278
<id>github</id>
8379
<url>https://maven.pkg.github.com/cnescatlab/i-CodeCNES</url>
8480
<snapshots>
85-
<enabled>true</enabled>
81+
<enabled>false</enabled>
8682
</snapshots>
8783
</repository>
8884
</repositories>
@@ -104,13 +100,6 @@
104100
<artifactId>commons-lang3</artifactId>
105101
<version>3.17.0</version>
106102
</dependency>
107-
<!-- unit tests -->
108-
<!-- <dependency>
109-
<groupId>org.sonarsource.sonarqube</groupId>
110-
<artifactId>sonar-testing-harness</artifactId>
111-
<version>${sonar.version}</version>
112-
<scope>test</scope>
113-
</dependency> -->
114103
<dependency>
115104
<groupId>org.sonarsource.sonarqube</groupId>
116105
<artifactId>sonar-plugin-api-impl</artifactId>
@@ -257,4 +246,4 @@
257246

258247
</plugins>
259248
</build>
260-
</project>
249+
</project>

src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java

Lines changed: 88 additions & 69 deletions
Large diffs are not rendered by default.

src/main/java/fr/cnes/sonar/plugins/icode/languages/ICodeLanguage.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
*/
1717
package fr.cnes.sonar.plugins.icode.languages;
1818

19-
import org.apache.commons.lang.StringUtils;
20-
import org.sonar.api.config.Configuration;
21-
import org.sonar.api.resources.AbstractLanguage;
22-
2319
import java.util.ArrayList;
2420
import java.util.List;
2521

22+
import org.apache.commons.lang3.StringUtils;
23+
import org.sonar.api.config.Configuration;
24+
import org.sonar.api.resources.AbstractLanguage;
25+
2626
/**
2727
* Declared language i-Code as the parent language for Fortran 77, Fortran 90.
2828
*/
@@ -37,8 +37,8 @@ public abstract class ICodeLanguage extends AbstractLanguage {
3737
* i-Code extension for i-Code specific properties, Metrics and Rules.
3838
*
3939
* @param configuration Inject SonarQube configuration into this extension.
40-
* @param key Key of the language to set.
41-
* @param name Name of the language to set.
40+
* @param key Key of the language to set.
41+
* @param name Name of the language to set.
4242
*/
4343
public ICodeLanguage(final Configuration configuration, final String key, final String name) {
4444
super(key, name);
@@ -75,20 +75,20 @@ public String[] getFileSuffixes() {
7575

7676
/**
7777
* Delete all empty string values into a input String array.
78-
*
78+
*
7979
* @param stringArray Input String array.
8080
*
8181
* @return Output String array without empty string values.
8282
*/
83-
public static String[] filterEmptyStrings(final String[] stringArray) {
84-
List<String> nonEmptyStrings = new ArrayList<>();
85-
for (final String string : stringArray) {
86-
if (StringUtils.isNotBlank(string.trim())) {
87-
nonEmptyStrings.add(string.trim());
88-
}
89-
}
90-
return nonEmptyStrings.toArray(new String[nonEmptyStrings.size()]);
91-
}
83+
public static String[] filterEmptyStrings(final String[] stringArray) {
84+
List<String> nonEmptyStrings = new ArrayList<>();
85+
for (final String string : stringArray) {
86+
if (StringUtils.isNotBlank(string.trim())) {
87+
nonEmptyStrings.add(string.trim());
88+
}
89+
}
90+
return nonEmptyStrings.toArray(new String[nonEmptyStrings.size()]);
91+
}
9292

9393
/**
9494
* Assert obj is the same object as this.
@@ -98,7 +98,7 @@ public static String[] filterEmptyStrings(final String[] stringArray) {
9898
*/
9999
@Override
100100
public boolean equals(final Object obj) {
101-
return obj==this;
101+
return super.equals(obj);
102102
}
103103

104104
/**

src/main/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfiles.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
*/
1717
package fr.cnes.sonar.plugins.icode.languages;
1818

19-
import fr.cnes.sonar.plugins.icode.rules.ICodeRulesDefinition;
20-
import fr.cnes.sonar.plugins.icode.rules.RulesRepository;
19+
import java.util.List;
2120

21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
2223
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition;
23-
import org.sonar.api.utils.log.Logger;
24-
import org.sonar.api.utils.log.Loggers;
2524
import org.sonar.api.server.rule.RulesDefinition.NewRule;
2625

27-
import java.util.List;
26+
import fr.cnes.sonar.plugins.icode.rules.ICodeRulesDefinition;
27+
import fr.cnes.sonar.plugins.icode.rules.RulesRepository;
2828

2929
/**
3030
* Built-in quality profile format since SonarQube 9.9
3131
*/
3232
public final class ICodeQualityProfiles implements BuiltInQualityProfilesDefinition {
3333

3434
/** Logger for this class. **/
35-
private static final Logger LOGGER = Loggers.get(ICodeQualityProfiles.class);
35+
private static final Logger LOGGER = LoggerFactory.getLogger(ICodeQualityProfiles.class);
3636

3737
/** Display name for the built-in quality profile. **/
3838
private static final String I_CODE_RULES_PROFILE_NAME = "Sonar way";
@@ -54,12 +54,13 @@ public void define(final Context context) {
5454
/**
5555
* Create a built in quality profile for a specific language.
5656
*
57-
* @param context SonarQube context in which create the profile.
57+
* @param context SonarQube context in which create the profile.
5858
* @param repository Rules' repository.
59-
* @param language Language key of the associated profile.
60-
* @param rules Rules to activate.
59+
* @param language Language key of the associated profile.
60+
* @param rules Rules to activate.
6161
*/
62-
private void createBuiltInProfile(final Context context, final String repository, final String languageKey, final List<NewRule> rules) {
62+
private void createBuiltInProfile(final Context context, final String repository, final String languageKey,
63+
final List<NewRule> rules) {
6364
// Create a builder for the rules' repository.
6465
NewBuiltInQualityProfile profile = context.createBuiltInQualityProfile(I_CODE_RULES_PROFILE_NAME, languageKey);
6566

@@ -70,6 +71,7 @@ private void createBuiltInProfile(final Context context, final String repository
7071
}
7172
profile.setDefault(true);
7273
profile.done();
73-
LOGGER.info(String.format("%s rules are activated for the repository %s.", profile.activeRules().size(), repository));
74+
LOGGER.info(String.format("%s rules are activated for the repository %s.", profile.activeRules().size(),
75+
repository));
7476
}
7577
}

0 commit comments

Comments
 (0)