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

Bump github/super-linter from 5 to 6 #111

Merged
merged 6 commits into from
Jun 5, 2024
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
67 changes: 33 additions & 34 deletions .github/linters/sun_checks.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--

Expand Down Expand Up @@ -44,44 +44,44 @@
<property name="fileExtensions" value="java, properties, xml"/>

<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<!-- See https://checkstyle.org/filefilters/index.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
<!-- https://checkstyle.org/filters/suppressionfilter.html -->
<module name="SuppressionFilter">
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}" default="checkstyle-suppressions.xml" />
<property name="file" value="${org.checkstyle.sun.suppressionfilter.config}"
default="checkstyle-suppressions.xml" />
<property name="optional" value="true"/>
</module>


<!-- Checks that a package-info.java file exists for each package. -->
<!-- See https://checkstyle.org/config_javadoc.html#JavadocPackage -->
<!-- See https://checkstyle.org/checks/javadoc/javadocpackage.html#JavadocPackage -->
<module name="JavadocPackage"/>

<!-- Checks whether files end with a new line. -->
<!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
<!-- See https://checkstyle.org/checks/misc/newlineatendoffile.html -->
<module name="NewlineAtEndOfFile"/>

<!-- Checks that property files contain the same keys. -->
<!-- See https://checkstyle.org/config_misc.html#Translation -->
<!-- See https://checkstyle.org/checks/misc/translation.html -->
<module name="Translation"/>

<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/config_sizes.html -->
<!-- See https://checkstyle.org/checks/sizes/index.html -->
<module name="FileLength"/>
<!--module name="LineLength">
<property name="fileExtensions" value="java"/>
<property name="max" value="120"/>
</module> -->
</module> Disabled online due to long lines-->

<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/config_whitespace.html -->
<!-- See https://checkstyle.org/checks/whitespace/index.html -->
<module name="FileTabCharacter"/>

<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
<!-- See https://checkstyle.org/checks/misc/index.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
Expand All @@ -90,18 +90,16 @@
</module>

<!-- Checks for Headers -->
<!-- See https://checkstyle.org/config_header.html -->
<!-- See https://checkstyle.org/checks/header/index.html -->
<!-- <module name="Header"> -->
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
<!-- <property name="fileExtensions" value="java"/> -->
<!-- </module> -->

<!-- Enables @SuppressWarnings Support -->
<module name="SuppressWarningsFilter"/>
<module name="TreeWalker">

<!-- Checks for Javadoc comments. -->
<!-- See https://checkstyle.org/config_javadoc.html -->
<!-- See https://checkstyle.org/checks/javadoc/index.html -->
<module name="InvalidJavadocPosition"/>
<module name="JavadocMethod"/>
<module name="JavadocType"/>
Expand All @@ -114,7 +112,7 @@
<module name="SuppressWarningsHolder"/>

<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/config_naming.html -->
<!-- See https://checkstyle.org/checks/naming/index.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
Expand All @@ -126,22 +124,21 @@
<module name="TypeName"/>

<!-- Checks for imports -->
<!-- See https://checkstyle.org/config_imports.html -->
<!-- See https://checkstyle.org/checks/imports/index.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/config_sizes.html -->
<!-- See https://checkstyle.org/checks/sizes/index.html -->
<module name="MethodLength"/>
<module name="ParameterNumber"/>

<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/config_whitespace.html -->
<!-- See https://checkstyle.org/checks/whitespace/index.html -->
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
Expand All @@ -154,20 +151,20 @@
<module name="WhitespaceAround"/>

<!-- Modifier Checks -->
<!-- See https://checkstyle.org/config_modifiers.html -->
<!-- See https://checkstyle.org/checks/modifier/index.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See https://checkstyle.org/config_blocks.html -->
<!-- See https://checkstyle.org/checks/blocks/index.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>

<!-- Checks for common coding problems -->
<!-- See https://checkstyle.org/config_coding.html -->
<!-- See https://checkstyle.org/checks/coding/index.html -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<!-- <module name="HiddenField">
Expand All @@ -176,14 +173,14 @@
</module> Disabled online due to constructors-->
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!-- <module name="MagicNumber"/> Disabled only online-->
<!-- <module name="MagicNumber"/> Disabled only online-->
<module name="MissingSwitchDefault"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See https://checkstyle.org/config_design.html -->
<!-- See https://checkstyle.org/checks/design/index.html -->
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
Expand All @@ -194,17 +191,19 @@
</module>

<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
<!-- See https://checkstyle.org/checks/misc/index.html -->
<module name="ArrayTypeStyle"/>
<!-- <module name="FinalParameters"/> Disabled online due to constructors-->
<module name="TodoComment"/>
<module name="UpperEll"/>

<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
<!-- https://checkstyle.org/filters/suppressionxpathfilter.html -->
<module name="SuppressionXpathFilter">
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}" default="checkstyle-xpath-suppressions.xml" />
<property name="file" value="${org.checkstyle.sun.suppressionxpathfilter.config}"
default="checkstyle-xpath-suppressions.xml" />
<property name="optional" value="true"/>
</module>
<module name="SuppressionCommentFilter"/>
</module>

</module>
</module>

</module>
2 changes: 1 addition & 1 deletion .github/workflows/lintChanges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fetch-depth: 0

- name: Lint_Java
uses: github/super-linter@v5
uses: github/super-linter@v6
env:
VALIDATE_ALL_CODEBASE: true # lint all files
VALIDATE_JAVA: true # only lint Java files
Expand Down
33 changes: 17 additions & 16 deletions src/test/java/io/tus/java/client/TestTusClient.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package io.tus.java.client;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
Expand All @@ -21,6 +16,12 @@
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

/**
* Class to test the tus-Client.
*/
Expand All @@ -32,7 +33,7 @@ public class TestTusClient extends MockServerProvider {
@Test
public void testTusClient() {
TusClient client = new TusClient();
assertEquals(client.getUploadCreationURL(), null);
assertNull(client.getUploadCreationURL());
}

/**
Expand Down Expand Up @@ -63,14 +64,14 @@ public void testSetUploadCreationURL() throws MalformedURLException {
@Test
public void testEnableResuming() {
TusClient client = new TusClient();
assertEquals(client.resumingEnabled(), false);
assertFalse(client.resumingEnabled());

TusURLStore store = new TusURLMemoryStore();
client.enableResuming(store);
assertEquals(client.resumingEnabled(), true);
assertTrue(client.resumingEnabled());

client.disableResuming();
assertEquals(client.resumingEnabled(), false);
assertFalse(client.resumingEnabled());
}

/**
Expand Down Expand Up @@ -248,22 +249,22 @@ public void testResumeUpload() throws ResumingNotEnabledException, FingerprintNo
/**
* Test Implementation for a {@link TusURLStore}.
*/
private class TestResumeUploadStore implements TusURLStore {
private final class TestResumeUploadStore implements TusURLStore {
public void set(String fingerprint, URL url) {
assertTrue("set method must not be called", false);
fail("set method must not be called");
}

public URL get(String fingerprint) {
assertEquals(fingerprint, "test-fingerprint");

try {
return new URL(mockServerURL.toString() + "/foo");
} catch (Exception e) { }
} catch (Exception ignored) { }
return null;
}

public void remove(String fingerprint) {
assertTrue("remove method must not be called", false);
fail("remove method must not be called");
}
}

Expand Down Expand Up @@ -513,14 +514,14 @@ public void testRemoveFingerprintOnSuccessDisabled() throws IOException, Protoco
store.set("fingerprint", dummyURL);
client.enableResuming(store);

assertTrue(!client.removeFingerprintOnSuccessEnabled());
assertFalse(client.removeFingerprintOnSuccessEnabled());

TusUpload upload = new TusUpload();
upload.setFingerprint("fingerprint");

client.uploadFinished(upload);

assertTrue(dummyURL.equals(store.get("fingerprint")));
assertEquals(dummyURL, store.get("fingerprint"));

}

Expand Down Expand Up @@ -548,7 +549,7 @@ public void testRemoveFingerprintOnSuccessEnabled() throws IOException, Protocol

client.uploadFinished(upload);

assertTrue(store.get("fingerprint") == null);
assertNull(store.get("fingerprint"));

}
}