Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 31 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
Lean ruleset: correctness/maintainability checks only, not code style.
-->
<module name="Checker">
<module name="TreeWalker">
<module name="EqualsHashCode"/>
<module name="EqualsAvoidNull"/>
<module name="EmptyCatchBlock"/>
<module name="EmptyStatement"/>
<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE"/>
</module>
<module name="UnusedImports"/>
<module name="RedundantImport"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="ModifiedControlVariable"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="OneStatementPerLine"/>
<module name="CovariantEquals"/>
<module name="NoFinalizer"/>
</module>
</module>
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,16 @@
<artifactId>sonar-maven-plugin</artifactId>
<version>5.8.0.7211</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<violationSeverity>warning</violationSeverity>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/spdx/tools/Verify.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,9 @@ public static List<String> 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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private void interpretRestrictions(List<OntClass.Restriction> 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();
}
}
Expand Down
Loading