Skip to content

Commit dcbb5a8

Browse files
committed
Merge remote-tracking branch 'origin/release/V3.5.0'
2 parents 704c2a8 + 3d0cb0b commit dcbb5a8

File tree

54 files changed

+913
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+913
-326
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pipeline {
2525
sh '$MVN_HOME/bin/mvn -s ${MAVEN_SETTINGS} -P release clean deploy -Dgit.commit=\$(git rev-parse --short HEAD)'
2626
}
2727
}
28-
mail body: "https://central.sonatype.com/publishing/deployments", to: "g.querret@riverside-software.fr", subject: "sonar-openedge - Publish artifact on Central"
28+
mail body: "https://central.sonatype.com/publishing/deployments", to: "jenkins-reports@riverside-software.fr", subject: "sonar-openedge - Publish artifact on Central"
2929
} else if ("develop" == env.BRANCH_NAME) {
3030
sh "$MVN_HOME/bin/mvn clean javadoc:javadoc deploy -Dmaven.test.failure.ignore=true -Dgit.commit=\$(git rev-parse --short HEAD)"
3131
} else if (env.BRANCH_NAME.startsWith("release") || env.BRANCH_NAME.startsWith("hotfix")) {

coverage-report/pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>eu.rssw</groupId>
77
<artifactId>sonar-openedge</artifactId>
8-
<version>3.4.1</version>
8+
<version>3.5.0</version>
99
</parent>
1010
<groupId>eu.rssw.openedge.parsers</groupId>
1111
<artifactId>coverage-report</artifactId>
@@ -21,37 +21,37 @@
2121
<dependency>
2222
<groupId>eu.rssw.openedge.rcode</groupId>
2323
<artifactId>rcode-reader</artifactId>
24-
<version>3.4.1</version>
24+
<version>3.5.0</version>
2525
</dependency>
2626
<dependency>
2727
<groupId>eu.rssw.sonar.openedge</groupId>
2828
<artifactId>sonar-openedge-plugin</artifactId>
29-
<version>3.4.1</version>
29+
<version>3.5.0</version>
3030
</dependency>
3131
<dependency>
3232
<groupId>eu.rssw.openedge.parsers</groupId>
3333
<artifactId>proparse</artifactId>
34-
<version>3.4.1</version>
34+
<version>3.5.0</version>
3535
</dependency>
3636
<dependency>
3737
<groupId>eu.rssw.openedge.parsers</groupId>
3838
<artifactId>profiler-parser</artifactId>
39-
<version>3.4.1</version>
39+
<version>3.5.0</version>
4040
</dependency>
4141
<dependency>
4242
<groupId>eu.rssw.openedge.parsers</groupId>
4343
<artifactId>database-parser</artifactId>
44-
<version>3.4.1</version>
44+
<version>3.5.0</version>
4545
</dependency>
4646
<dependency>
4747
<groupId>eu.rssw.openedge.parsers</groupId>
4848
<artifactId>listing-parser</artifactId>
49-
<version>3.4.1</version>
49+
<version>3.5.0</version>
5050
</dependency>
5151
<dependency>
5252
<groupId>eu.rssw.openedge.checks</groupId>
5353
<artifactId>openedge-checks</artifactId>
54-
<version>3.4.1</version>
54+
<version>3.5.0</version>
5555
</dependency>
5656
</dependencies>
5757

database-parser/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>eu.rssw</groupId>
77
<artifactId>sonar-openedge</artifactId>
8-
<version>3.4.1</version>
8+
<version>3.5.0</version>
99
</parent>
1010
<groupId>eu.rssw.openedge.parsers</groupId>
1111
<artifactId>database-parser</artifactId>

listing-parser/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>eu.rssw</groupId>
77
<artifactId>sonar-openedge</artifactId>
8-
<version>3.4.1</version>
8+
<version>3.5.0</version>
99
</parent>
1010
<groupId>eu.rssw.openedge.parsers</groupId>
1111
<artifactId>listing-parser</artifactId>

openedge-checks/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>eu.rssw</groupId>
77
<artifactId>sonar-openedge</artifactId>
8-
<version>3.4.1</version>
8+
<version>3.5.0</version>
99
</parent>
1010
<groupId>eu.rssw.openedge.checks</groupId>
1111
<artifactId>openedge-checks</artifactId>
@@ -23,12 +23,12 @@
2323
<dependency>
2424
<groupId>eu.rssw.openedge.parsers</groupId>
2525
<artifactId>database-parser</artifactId>
26-
<version>3.4.1</version>
26+
<version>3.5.0</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>eu.rssw.openedge.parsers</groupId>
3030
<artifactId>proparse</artifactId>
31-
<version>3.4.1</version>
31+
<version>3.5.0</version>
3232
</dependency>
3333
<dependency>
3434
<groupId>org.sonarsource.sonarqube</groupId>

openedge-checks/src/main/java/org/sonar/plugins/openedge/api/AnnotationBasedRulesDefinition.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.sonar.api.server.rule.RulesDefinition.OwaspTop10Version;
4545
import org.sonar.api.server.rule.RulesDefinitionAnnotationLoader;
4646
import org.sonar.api.utils.AnnotationUtils;
47-
import org.sonar.api.utils.Version;
4847
import org.sonar.check.Rule;
4948
import org.sonar.check.RuleProperty;
5049
import org.sonar.plugins.openedge.api.model.CWE;
@@ -99,6 +98,7 @@ public class AnnotationBasedRulesDefinition {
9998

10099
private final NewRepository repository;
101100
private final String basePath;
101+
@SuppressWarnings("unused")
102102
private final SonarRuntime runtime;
103103

104104
public AnnotationBasedRulesDefinition(NewRepository repository, String languageKey, SonarRuntime runtime) {
@@ -121,8 +121,7 @@ public void addRuleClasses(boolean failIfNoExplicitKey, Iterable<Class> ruleClas
121121
rule.setTemplate(AnnotationUtils.getAnnotation(ruleClass, RuleTemplate.class) != null);
122122
setupDocumentation(rule, ruleClass);
123123
setupSecurityModel(rule, ruleClass);
124-
if (runtime.getApiVersion().isGreaterThanOrEqual(Version.create(10, 1)))
125-
setupCleanCode(rule, ruleClass);
124+
setupCleanCode(rule, ruleClass);
126125
try {
127126
setupSqaleModel(rule, ruleClass);
128127
} catch (RuntimeException e) {

openedge-plugin/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>eu.rssw</groupId>
77
<artifactId>sonar-openedge</artifactId>
8-
<version>3.4.1</version>
8+
<version>3.5.0</version>
99
</parent>
1010
<groupId>eu.rssw.sonar.openedge</groupId>
1111
<artifactId>sonar-openedge-plugin</artifactId>
@@ -30,17 +30,17 @@
3030
<dependency>
3131
<groupId>eu.rssw.openedge.checks</groupId>
3232
<artifactId>openedge-checks</artifactId>
33-
<version>3.4.1</version>
33+
<version>3.5.0</version>
3434
</dependency>
3535
<dependency>
3636
<groupId>eu.rssw.openedge.parsers</groupId>
3737
<artifactId>listing-parser</artifactId>
38-
<version>3.4.1</version>
38+
<version>3.5.0</version>
3939
</dependency>
4040
<dependency>
4141
<groupId>eu.rssw.openedge.parsers</groupId>
4242
<artifactId>profiler-parser</artifactId>
43-
<version>3.4.1</version>
43+
<version>3.5.0</version>
4444
</dependency>
4545
<dependency>
4646
<groupId>org.sonarsource.sonarqube</groupId>
@@ -100,8 +100,8 @@
100100
<pluginKey>${sonar.pluginKey}</pluginKey>
101101
<pluginName>${sonar.pluginName}</pluginName>
102102
<pluginClass>${sonar.pluginClass}</pluginClass>
103-
<!-- SonarQube 9.9 -->
104-
<pluginApiMinVersion>9.14</pluginApiMinVersion>
103+
<!-- SonarQube 10.8 -->
104+
<pluginApiMinVersion>10.14</pluginApiMinVersion>
105105
<sonarLintSupported>true</sonarLintSupported>
106106
<jreMinVersion>17</jreMinVersion>
107107
<skipDependenciesPackaging>true</skipDependenciesPackaging>

openedge-plugin/src/main/java/org/sonar/plugins/openedge/OpenEdgePlugin.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.sonar.api.PropertyType;
2424
import org.sonar.api.SonarProduct;
2525
import org.sonar.api.config.PropertyDefinition;
26-
import org.sonar.api.resources.Qualifiers;
26+
import org.sonar.api.config.PropertyDefinition.ConfigScope;
2727
import org.sonar.plugins.openedge.api.Constants;
2828
import org.sonar.plugins.openedge.decorator.CommonDBMetricsDecorator;
2929
import org.sonar.plugins.openedge.decorator.CommonMetricsDecorator;
@@ -84,7 +84,7 @@ public void define(Context context) {
8484
.type(PropertyType.BOOLEAN) //
8585
.category(CATEGORY_OPENEDGE) //
8686
.subCategory(SUBCATEGORY_GENERAL) //
87-
.onQualifiers(Qualifiers.PROJECT) //
87+
.onConfigScopes(ConfigScope.PROJECT) //
8888
.defaultValue(Boolean.FALSE.toString()) //
8989
.build());
9090

@@ -94,7 +94,7 @@ public void define(Context context) {
9494
.type(PropertyType.BOOLEAN) //
9595
.category(CATEGORY_OPENEDGE) //
9696
.subCategory(SUBCATEGORY_GENERAL) //
97-
.onQualifiers(Qualifiers.PROJECT) //
97+
.onConfigScopes(ConfigScope.PROJECT) //
9898
.defaultValue(Boolean.FALSE.toString()) //
9999
.build());
100100

@@ -105,7 +105,7 @@ public void define(Context context) {
105105
.type(PropertyType.BOOLEAN) //
106106
.category(CATEGORY_OPENEDGE) //
107107
.subCategory(SUBCATEGORY_GENERAL) //
108-
.onQualifiers(Qualifiers.PROJECT) //
108+
.onConfigScopes(ConfigScope.PROJECT) //
109109
.defaultValue(Boolean.FALSE.toString()) //
110110
.build());
111111

@@ -116,7 +116,7 @@ public void define(Context context) {
116116
.category(CATEGORY_OPENEDGE) //
117117
.subCategory(SUBCATEGORY_DEBUG) //
118118
.defaultValue(Boolean.FALSE.toString()) //
119-
.onQualifiers(Qualifiers.PROJECT) //
119+
.onConfigScopes(ConfigScope.PROJECT) //
120120
.build());
121121

122122
context.addExtension(PropertyDefinition.builder(Constants.SUFFIXES) //
@@ -126,7 +126,7 @@ public void define(Context context) {
126126
.defaultValue(OpenEdge.DEFAULT_FILE_SUFFIXES) //
127127
.category(CATEGORY_OPENEDGE) //
128128
.subCategory(SUBCATEGORY_GENERAL) //
129-
.onQualifiers(Qualifiers.PROJECT) //
129+
.onConfigScopes(ConfigScope.PROJECT) //
130130
.build());
131131

132132
context.addExtension(PropertyDefinition.builder(Constants.DB_SUFFIXES) //
@@ -136,7 +136,7 @@ public void define(Context context) {
136136
.defaultValue("df") //
137137
.category(CATEGORY_OPENEDGE) //
138138
.subCategory(SUBCATEGORY_GENERAL) //
139-
.onQualifiers(Qualifiers.PROJECT) //
139+
.onConfigScopes(ConfigScope.PROJECT) //
140140
.build());
141141

142142
context.addExtension(PropertyDefinition.builder(Constants.INCLUDE_SUFFIXES) //
@@ -146,7 +146,7 @@ public void define(Context context) {
146146
.defaultValue(OpenEdge.DEFAULT_INCLUDE_FILE_SUFFIXES) //
147147
.category(CATEGORY_OPENEDGE) //
148148
.subCategory(SUBCATEGORY_GENERAL) //
149-
.onQualifiers(Qualifiers.PROJECT) //
149+
.onConfigScopes(ConfigScope.PROJECT) //
150150
.build());
151151

152152
context.addExtension(PropertyDefinition.builder(Constants.CPD_ANNOTATIONS) //
@@ -156,7 +156,7 @@ public void define(Context context) {
156156
.defaultValue("Generated") //
157157
.category(CATEGORY_OPENEDGE) //
158158
.subCategory(SUBCATEGORY_GENERAL) //
159-
.onQualifiers(Qualifiers.PROJECT) //
159+
.onConfigScopes(ConfigScope.PROJECT) //
160160
.build());
161161

162162
context.addExtension(PropertyDefinition.builder(Constants.SKIP_ANNOTATIONS) //
@@ -166,7 +166,7 @@ public void define(Context context) {
166166
.defaultValue("@InitializeComponent") //
167167
.category(CATEGORY_OPENEDGE) //
168168
.subCategory(SUBCATEGORY_GENERAL) //
169-
.onQualifiers(Qualifiers.PROJECT) //
169+
.onConfigScopes(ConfigScope.PROJECT) //
170170
.build());
171171

172172
context.addExtension(PropertyDefinition.builder(Constants.BACKSLASH_ESCAPE) //
@@ -176,7 +176,7 @@ public void define(Context context) {
176176
.defaultValue(Boolean.FALSE.toString()) //
177177
.category(CATEGORY_OPENEDGE) //
178178
.subCategory(SUBCATEGORY_GENERAL) //
179-
.onQualifiers(Qualifiers.PROJECT) //
179+
.onConfigScopes(ConfigScope.PROJECT) //
180180
.build());
181181
}
182182

openedge-plugin/src/main/java/org/sonar/plugins/openedge/foundation/OpenEdgeRulesDefinition.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.sonar.api.SonarRuntime;
3131
import org.sonar.api.rules.RuleType;
3232
import org.sonar.api.server.rule.RulesDefinition;
33-
import org.sonar.api.utils.Version;
3433
import org.sonar.check.Priority;
3534
import org.sonar.plugins.openedge.api.AnnotationBasedRulesDefinition;
3635
import org.sonar.plugins.openedge.api.Constants;
@@ -58,9 +57,6 @@ public OpenEdgeRulesDefinition(SonarRuntime runtime) {
5857

5958
@Override
6059
public void define(Context context) {
61-
// Clean code attributes can only be set in version 10 and above
62-
var version10 = runtime.getApiVersion().isGreaterThanOrEqual(Version.create(10, 1));
63-
6460
var repository = context //
6561
.createRepository(Constants.STD_REPOSITORY_KEY, Constants.LANGUAGE_KEY) //
6662
.setName(REPOSITORY_NAME);
@@ -70,7 +66,7 @@ public void define(Context context) {
7066
try (var input = this.getClass().getResourceAsStream("/rules/compiler-warnings.json");
7167
var reader = new InputStreamReader(input)) {
7268
for (var ruleDef : new GsonBuilder().create().fromJson(reader, RuleDefinition[].class)) {
73-
createWarningRule(repository, ruleDef, version10);
69+
createWarningRule(repository, ruleDef);
7470
}
7571
} catch (IOException caught) {
7672
LOGGER.error("Unable to read compiler warning rules definition", caught);
@@ -101,7 +97,7 @@ public static boolean isWarningManagedByCABL(int warningNum) {
10197
return IntStream.of(OpenEdgeRulesDefinition.WARNING_MSGS).anyMatch(x -> x == warningNum);
10298
}
10399

104-
private NewRule createWarningRule(NewRepository repository, RuleDefinition def, boolean cleanCode) {
100+
private NewRule createWarningRule(NewRepository repository, RuleDefinition def) {
105101
var rule = repository.createRule(def.key);
106102
rule.setName(def.name) //
107103
.setSeverity(def.priority) //
@@ -110,12 +106,10 @@ private NewRule createWarningRule(NewRepository repository, RuleDefinition def,
110106
.setType(RuleType.CODE_SMELL) //
111107
.setDebtRemediationFunction(rule.debtRemediationFunctions().constantPerIssue(def.remediationCost + "min"));
112108
setupDocumentation(rule, def.key);
113-
if (cleanCode) {
114-
rule.setCleanCodeAttribute(Constants.lookupCleanCodeAttribute(def.cleanCodeAttribute));
115-
for (var impact : def.impacts) {
116-
rule.addDefaultImpact(Constants.lookupSoftwareQuality(impact.quality),
117-
Constants.lookupSeverity(impact.severity));
118-
}
109+
rule.setCleanCodeAttribute(Constants.lookupCleanCodeAttribute(def.cleanCodeAttribute));
110+
for (var impact : def.impacts) {
111+
rule.addDefaultImpact(Constants.lookupSoftwareQuality(impact.quality),
112+
Constants.lookupSeverity(impact.severity));
119113
}
120114

121115
return rule;

openedge-plugin/src/main/java/org/sonar/plugins/openedge/foundation/OpenEdgeSettings.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import org.sonar.api.batch.fs.InputFile;
6666
import org.sonar.api.config.Configuration;
6767
import org.sonar.api.scanner.ScannerSide;
68-
import org.sonar.api.utils.Version;
6968
import org.sonar.plugins.openedge.api.Constants;
7069
import org.sonar.plugins.openedge.api.objects.DatabaseWrapper;
7170
import org.sonarsource.api.sonarlint.SonarLintSide;
@@ -300,20 +299,25 @@ private final void initializeProlibCache() {
300299
}
301300

302301
private final void initializeRCodeCache() {
303-
Optional<String> opt = config.get(Constants.SLINT_RCODE_CACHE);
302+
var opt = config.get(Constants.SLINT_RCODE_CACHE);
304303
if (opt.isPresent()) {
305-
File rcodeCache = new File(opt.get());
306-
if (rcodeCache.exists() && rcodeCache.isFile() && rcodeCache.canRead()) {
304+
LOG.debug("Reading rcode cache from {}", opt.get());
305+
var rcodeCache = Path.of(opt.get());
306+
if (java.nio.file.Files.isRegularFile(rcodeCache) && java.nio.file.Files.isReadable(rcodeCache)) {
307307
try {
308-
for (String str : java.nio.file.Files.readAllLines(rcodeCache.toPath(), StandardCharsets.UTF_8)) {
309-
int commaPos = str.indexOf(':');
308+
for (var str : java.nio.file.Files.readAllLines(rcodeCache, StandardCharsets.UTF_8)) {
309+
var commaPos = str.indexOf(':');
310310
if ((commaPos > 0) && (str.length() > commaPos)) {
311-
defaultSession.injectTypeInfo(
312-
new TypeInfoRCodeProxy(str.substring(0, commaPos), Paths.get(str.substring(commaPos + 1))));
311+
var clsName = str.substring(0, commaPos);
312+
var rcodePath = Path.of(str.substring(commaPos + 1));
313+
if (!rcodePath.isAbsolute())
314+
rcodePath = fileSystem.baseDir().toPath().resolve(rcodePath);
315+
var proxy = new TypeInfoRCodeProxy(clsName, rcodePath);
316+
defaultSession.injectTypeInfo(proxy);
313317
}
314318
}
315319
} catch (IOException caught) {
316-
LOG.error("Unable to read PL cache " + rcodeCache.getAbsolutePath(), caught);
320+
LOG.error("Unable to read rcode cache " + rcodeCache.toAbsolutePath(), caught);
317321
}
318322
}
319323
}
@@ -565,10 +569,8 @@ public File getListingFile(InputFile file) {
565569
public boolean useCache() {
566570
if (runtime.getProduct() != SonarProduct.SONARQUBE)
567571
return false;
568-
boolean developerOrMore = ((runtime.getEdition() == SonarEdition.DEVELOPER)
569-
|| (runtime.getEdition() == SonarEdition.ENTERPRISE) || (runtime.getEdition() == SonarEdition.DATACENTER));
570-
boolean version94OrMore = runtime.getApiVersion().isGreaterThanOrEqual(Version.create(9, 4));
571-
return developerOrMore && version94OrMore;
572+
return (runtime.getEdition() == SonarEdition.DEVELOPER) || (runtime.getEdition() == SonarEdition.ENTERPRISE)
573+
|| (runtime.getEdition() == SonarEdition.DATACENTER);
572574
}
573575

574576
private File getFileFromRtbListDir(String fileName, String extension) {

0 commit comments

Comments
 (0)