diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c831ecf..a5ef6dc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -45,5 +45,7 @@ jobs:
else
mvn --batch-mode --update-snapshots verify
fi
+ - name: Checkstyle analysis
+ run: mvn --batch-mode checkstyle:check
- name: SpotBugs analysis
run: mvn --batch-mode spotbugs:check
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 0000000..a218ddb
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 9ed1dba..e23cbbc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -403,6 +403,16 @@
sonar-maven-plugin
5.8.0.7211
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.6.0
+
+ checkstyle.xml
+ true
+ warning
+
+
com.github.spotbugs
spotbugs-maven-plugin
diff --git a/src/main/java/org/spdx/tools/Verify.java b/src/main/java/org/spdx/tools/Verify.java
index 64056b7..1736ceb 100644
--- a/src/main/java/org/spdx/tools/Verify.java
+++ b/src/main/java/org/spdx/tools/Verify.java
@@ -228,10 +228,9 @@ public static List verify(String filePath, SerFileType fileType) throws
for (String verifyMsg:verify) {
if (!retval.contains(verifyMsg)) {
// Check for deprecated licenses - should be warnings, not errors
- if (verifyMsg.contains(" is deprecated.")) {
- verifyMsg = verifyMsg.replaceAll("error:", "warning:");
- }
- retval.add(verifyMsg);
+ String msg = verifyMsg.contains(" is deprecated.")
+ ? verifyMsg.replaceAll("error:", "warning:") : verifyMsg;
+ retval.add(msg);
}
}
}
diff --git a/src/main/java/org/spdx/tools/schema/AbstractOwlRdfConverter.java b/src/main/java/org/spdx/tools/schema/AbstractOwlRdfConverter.java
index 778b815..287f438 100644
--- a/src/main/java/org/spdx/tools/schema/AbstractOwlRdfConverter.java
+++ b/src/main/java/org/spdx/tools/schema/AbstractOwlRdfConverter.java
@@ -221,7 +221,7 @@ private void interpretRestrictions(List restrictions) {
// get the type from the range of the property
property.ranges().forEach(range -> {
if (range.isURIResource()) {
- if (Objects.isNull(typeUri) || typeUri.equals("http://www.w3.org/2000/01/rdf-schema#Literal")) {
+ if (Objects.isNull(typeUri) || "http://www.w3.org/2000/01/rdf-schema#Literal".equals(typeUri)) {
typeUri = range.asResource().getURI();
}
}