Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: stop ignoring checkstyle findings #4864

Merged
merged 10 commits into from
Aug 27, 2021
30 changes: 17 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,24 @@ pipeline {
stage('Analytics') {
steps {
sh './gradlew --console=plain check -x test'
// the default resolution when omitting `defaultBranch` is to `master`
// this is wrong in our case, so explicitly set `develop` as default
// TODO: does this also work for PRs with different base branch?
discoverGitReferenceBuild(defaultBranch: 'develop')
recordIssues skipBlames: true,
tools: [
checkStyle(pattern: '**/build/reports/checkstyle/*.xml'),
spotBugs(pattern: '**/build/reports/spotbugs/main/*.xml', useRankAsPriority: true),
pmdParser(pattern: '**/build/reports/pmd/*.xml')
]
}
post {
always {
// the default resolution when omitting `defaultBranch` is to `master`
// this is wrong in our case, so explicitly set `develop` as default
// TODO: does this also work for PRs with different base branch?
discoverGitReferenceBuild(defaultBranch: 'develop')
recordIssues skipBlames: true, enabledForFailure: true,
tools: [
checkStyle(pattern: '**/build/reports/checkstyle/*.xml'),
spotBugs(pattern: '**/build/reports/spotbugs/main/*.xml', useRankAsPriority: true),
pmdParser(pattern: '**/build/reports/pmd/*.xml')
]

recordIssues skipBlames: true,
tool: taskScanner(includePattern: '**/*.java,**/*.groovy,**/*.gradle', \
lowTags: 'WIBNIF', normalTags: 'TODO', highTags: 'ASAP')
recordIssues skipBlames: true, enabledForFailure: true,
tool: taskScanner(includePattern: '**/*.java,**/*.groovy,**/*.gradle', \
lowTags: 'WIBNIF', normalTags: 'TODO', highTags: 'ASAP')
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion config/gradle/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jacocoTestReport {
// Solo module builds in Jenkins get a copy of the config dir from the engine harness so it still lives at root/config
// TODO: Maybe update other projects like modules to pull the zipped dependency so fewer quirks are needed in Jenkins
checkstyle {
ignoreFailures = true
ignoreFailures = false
keturn marked this conversation as resolved.
Show resolved Hide resolved
configFile = new File(rootDir, 'config/metrics/checkstyle/checkstyle.xml')
configProperties.samedir = checkstyle.configFile.parentFile
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Environment {
*
* @param moduleNames a list of module names
*/
public Environment(Name... moduleNames) {
Environment(Name... moduleNames) {
try {
reset(Sets.newHashSet(moduleNames));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.lwjgl.opengl.GL11.GL_LINEAR_MIPMAP_LINEAR;
import static org.lwjgl.opengl.GL11.GL_NEAREST;
import static org.lwjgl.opengl.GL11.GL_NEAREST_MIPMAP_NEAREST;
import static org.lwjgl.opengl.GL11.GL_NORMALIZE;
import static org.lwjgl.opengl.GL11.GL_REPEAT;
import static org.lwjgl.opengl.GL11.glDepthFunc;
import static org.lwjgl.opengl.GL11.glEnable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ public final class CharacterMovementComponent implements Component {
@Range(min = 0, max = 5)
public float radius = 0.3f;
public CollisionGroup collisionGroup = StandardCollisionGroup.CHARACTER;
public List<CollisionGroup> collidesWith = Lists.<CollisionGroup>newArrayList(StandardCollisionGroup.WORLD, StandardCollisionGroup.SENSOR, StandardCollisionGroup.CHARACTER);
public List<CollisionGroup> collidesWith = Lists.<CollisionGroup>newArrayList(
StandardCollisionGroup.WORLD,
StandardCollisionGroup.SENSOR,
StandardCollisionGroup.CHARACTER
);
@Range(min = 0, max = 5)
public float pickupRadius = 1.5f;

Expand Down
4 changes: 1 addition & 3 deletions engine/src/main/java/org/terasology/engine/math/Side.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
package org.terasology.engine.math;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import org.joml.Vector3fc;
import org.joml.Vector3i;
import org.joml.Vector3ic;
import org.terasology.math.TeraMath;

import java.util.EnumSet;
import java.util.List;

/**
Expand All @@ -35,7 +33,7 @@ public enum Side {
public static final ImmutableList<Side> Y_VERTICAL_SIDE = ImmutableList.of(TOP, BOTTOM);
public static final ImmutableList<Side> Z_VERTICAL_SIDE = ImmutableList.of(FRONT, BACK);

private static final ImmutableList<Side> ALL_SIDES = ImmutableList.of(TOP ,BOTTOM ,LEFT ,RIGHT ,FRONT ,BACK);
private static final ImmutableList<Side> ALL_SIDES = ImmutableList.of(TOP, BOTTOM, LEFT, RIGHT, FRONT, BACK);
private final Vector3ic direction;

Side(Vector3i vector3i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ public static void draw(float x1, float y1, float x2, float y2, float width, Col
lineMeshData.position.rewind();
lineMeshData.color0.rewind();

lineMeshData.position.put(v1.set( x1 - rx + cx, y1 - ry + cy, 0.0f));
lineMeshData.position.put(v1.set( x1 + rx + cx, y1 + ry + cy, 0.0f));
lineMeshData.position.put(v1.set( x1 - tx - rx, y1 - ty - ry, 0.0f));
lineMeshData.position.put(v1.set( x1 + tx + rx, y1 + ty + ry, 0.0f));
lineMeshData.position.put(v1.set( x2 - rx - cx, y2 - ry - cy, 0.0f));
lineMeshData.position.put(v1.set( x2 + rx - cx, y2 + ry - cy, 0.0f));
lineMeshData.position.put(v1.set( x2 - tx - rx, y2 - ty - ry, 0.0f));
lineMeshData.position.put(v1.set( x2 + tx + rx, y2 + ty + ry, 0.0f));
lineMeshData.position.put(v1.set(x1 - rx + cx, y1 - ry + cy, 0.0f));
lineMeshData.position.put(v1.set(x1 + rx + cx, y1 + ry + cy, 0.0f));
lineMeshData.position.put(v1.set(x1 - tx - rx, y1 - ty - ry, 0.0f));
lineMeshData.position.put(v1.set(x1 + tx + rx, y1 + ty + ry, 0.0f));
lineMeshData.position.put(v1.set(x2 - rx - cx, y2 - ry - cy, 0.0f));
lineMeshData.position.put(v1.set(x2 + rx - cx, y2 + ry - cy, 0.0f));
lineMeshData.position.put(v1.set(x2 - tx - rx, y2 - ty - ry, 0.0f));
lineMeshData.position.put(v1.set(x2 + tx + rx, y2 + ty + ry, 0.0f));

if (!alphaBlend) {
lineMeshData.color0.put(c.set(v1.set(bRed, bGreen, bBlue)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ private void addProviderChain(Class<? extends WorldFacet> facet, boolean scalabl
}

/**
* Adds {@code provider} and all its dependencies (calculated by calling {@link #addProviderChain} to {@code orderedProviders} in the proper order.
* Adds {@code provider} and all its dependencies (calculated by calling {@link #addProviderChain}
* to {@code orderedProviders} in the proper order.
* Doesn't consider dependencies through {@code providedFacet}, because that's already required by something else.
*/
private void addRequirements(Class<? extends WorldFacet> providedFacet, FacetProvider provider, boolean scalable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@
* This implementation also supports decimal values such as <code>3.5G</code>.
*/
public class DataSizeConverter implements CommandLine.ITypeConverter<Long> {
protected final static Pattern pattern = Pattern.compile(
"(?<n>\\d+([.,]\\d*)?)" + // digits, maybe also a decimal part
"\\s*" +
"(?<suffix>\\p{Alpha})?b?", // a suffix character, optionally followed by B
Pattern.CASE_INSENSITIVE
);

@SuppressWarnings("unused") // used by Unit.valueOf
enum Unit {
B(1),
Expand All @@ -50,6 +43,13 @@ BigDecimal multiply(BigDecimal n) {
}
}

protected static final Pattern pattern = Pattern.compile(
"(?<n>\\d+([.,]\\d*)?)" + // digits, maybe also a decimal part
"\\s*" +
"(?<suffix>\\p{Alpha})?b?", // a suffix character, optionally followed by B
Pattern.CASE_INSENSITIVE
);

@Override
public Long convert(String value) {
if (value == null) {
Expand Down
14 changes: 7 additions & 7 deletions facades/PC/src/main/java/org/terasology/engine/Terasology.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ public final class Terasology implements Callable<Integer> {

@CommandLine.Spec CommandLine.Model.CommandSpec spec;

@SuppressWarnings("unused")
@Option(names = {"--help", "-help", "/help", "-h", "/h", "-?", "/?"}, usageHelp = true, description = "Show help")
private boolean helpRequested;

@Option(names = "--headless", description = "Start headless (no graphics)")
private boolean isHeadless;

@Option(names = "--max-data-size",
description = "Set maximum process data size [Linux only]",
paramLabel = "<size>",
Expand All @@ -102,6 +95,13 @@ public final class Terasology implements Callable<Integer> {
)
Integer outOfMemoryScore;

@SuppressWarnings("unused")
@Option(names = {"--help", "-help", "/help", "-h", "/h", "-?", "/?"}, usageHelp = true, description = "Show help")
private boolean helpRequested;

@Option(names = "--headless", description = "Start headless (no graphics)")
private boolean isHeadless;

@Option(names = "--crash-report", defaultValue = "true", negatable = true, description = "Enable crash reporting")
private boolean crashReportEnabled;

Expand Down