Merge branch 'pmd/new-rule3' into 'master'

Ref: add more PMD rule: bestpractices.xml/OneDeclarationPerLine

See merge request sheepitrenderfarm/client!316
This commit is contained in:
Laurent Clouet
2024-06-06 01:09:05 +00:00
4 changed files with 7 additions and 5 deletions

View File

@@ -14,6 +14,7 @@
<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" /> <rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" /> <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP" />
<rule ref="category/java/bestpractices.xml/CheckResultSet" /> <rule ref="category/java/bestpractices.xml/CheckResultSet" />
<rule ref="category/java/bestpractices.xml/OneDeclarationPerLine" />
<rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" /> <rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation" />
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter" /> <rule ref="category/java/bestpractices.xml/UnusedFormalParameter" />
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable" /> <rule ref="category/java/bestpractices.xml/UnusedLocalVariable" />

View File

@@ -122,7 +122,8 @@ import lombok.Data;
* @return string formatted with SheepIt Admin Log Viewer in mind * @return string formatted with SheepIt Admin Log Viewer in mind
*/ */
public String toString() { public String toString() {
String c = " CFG: ", n ="\n"; String c = " CFG: ";
String n ="\n";
return return
c + "version: " + getJarVersion() + n + c + "version: " + getJarVersion() + n +
c + "configFilePath: " + configFilePath + n + c + "configFilePath: " + configFilePath + n +

View File

@@ -100,10 +100,9 @@ public class Speedtest {
* @throws Exception * @throws Exception
*/ */
private <T> Pair<Long, T> runTimed(Callable<T> task) throws Exception { private <T> Pair<Long, T> runTimed(Callable<T> task) throws Exception {
long start, end; long start = System.nanoTime();
start = System.nanoTime();
T callValue = task.call(); T callValue = task.call();
end = System.nanoTime(); long end = System.nanoTime();
return new Pair<>(Duration.ofNanos(end - start).toMillis(), callValue); return new Pair<>(Duration.ofNanos(end - start).toMillis(), callValue);
} }

View File

@@ -66,7 +66,8 @@ public class Mac extends OS {
@Override public boolean isSupported() { @Override public boolean isSupported() {
String[] ver = operatingSystem.getVersionInfo().getVersion().split("\\."); String[] ver = operatingSystem.getVersionInfo().getVersion().split("\\.");
int majorVer = Integer.parseInt(ver[0]), minorVer = Integer.parseInt(ver[1]); int majorVer = Integer.parseInt(ver[0]);
int minorVer = Integer.parseInt(ver[1]);
return super.isSupported() && ((majorVer == 10 && minorVer >= 13) || majorVer >= 11); return super.isSupported() && ((majorVer == 10 && minorVer >= 13) || majorVer >= 11);
} }