Skip to content

Commit

Permalink
[SPARK-50678][BUILD] Clean up outdated style check rules related to G…
Browse files Browse the repository at this point in the history
…uava

### What changes were proposed in this pull request?
The version of Guava being used by Spark is 33.3.1 now, so this pr cleans up the outdated check rules from `dev/checkstyle.xml` and `scalastyle-config.xml`
-  The current version of Guava no longer has the `Objects.toStringHelper` method, so this check rule is no longer needed
- CVE-2020-8908 has been fixed after version 32.0.0, so the related check is no longer needed
- CVE-2023-2976 has been fixed after version 32.0.0, so the related check is no longer needed
- CVE-2018-10237 has been fixed after version 24.1.1, so the related check is no longer needed

### Why are the changes needed?
Clean up outdated style check rules related to Guava

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass Github Actions

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #49302 from LuciferYang/checkstyle-outdated.

Lead-authored-by: YangJie <[email protected]>
Co-authored-by: yangjie01 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
  • Loading branch information
LuciferYang authored and dongjoon-hyun committed Jan 3, 2025
1 parent 580b3c0 commit a59941a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
22 changes: 0 additions & 22 deletions dev/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,32 +172,10 @@
<property name="format" value="throw new \w+Error\("/>
<property name="message" value="Avoid throwing error in application code."/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="Objects\.toStringHelper"/>
<property name="message" value="Avoid using Object.toStringHelper. Use ToStringBuilder instead." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="new (java\.lang\.)?(Byte|Integer|Long|Short)\("/>
<property name="message" value="Use static factory 'valueOf' or 'parseXXX' instead of the deprecated constructors." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="Files\.createTempDir\("/>
<property name="message"
value="Avoid using com.google.common.io.Files.createTempDir() due to CVE-2020-8908.
Use org.apache.spark.network.util.JavaUtils.createTempDir() instead." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="FileBackedOutputStream"/>
<property name="message" value="Avoid using FileBackedOutputStream due to CVE-2023-2976." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="AtomicDoubleArray"/>
<property name="message" value="Avoid using AtomicDoubleArray due to CVE-2018-10237." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="CompoundOrdering"/>
<property name="message" value="Avoid using CompoundOrdering due to CVE-2018-10237." />
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="@Test\(expected"/>
<property name="message" value="Please use the `assertThrows` method to test for exceptions." />
Expand Down
27 changes: 0 additions & 27 deletions scalastyle-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -460,33 +460,6 @@ This file is divided into 3 sections:
<parameters><parameter name="ignore">-1,0,1,2,3</parameter></parameters>
</check>

<check customId="GuavaToStringHelper" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">Objects.toStringHelper</parameter></parameters>
<customMessage>Avoid using Object.toStringHelper. Use ToStringBuilder instead.</customMessage>
</check>

<check customId="GuavaFilesCreateTempDir" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">Files\.createTempDir\(</parameter></parameters>
<customMessage>Avoid using com.google.common.io.Files.createTempDir due to CVE-2020-8908.
Use org.apache.spark.util.Utils.createTempDir instead.
</customMessage>
</check>

<check customId="GuavaFileBackedOutputStream" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">FileBackedOutputStream</parameter></parameters>
<customMessage>Avoid using FileBackedOutputStream due to CVE-2023-2976.</customMessage>
</check>

<check customId="GuavaAtomicDoubleArray" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">AtomicDoubleArray</parameter></parameters>
<customMessage>Avoid using AtomicDoubleArray due to CVE-2018-10237.</customMessage>
</check>

<check customId="GuavaCompoundOrdering" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">CompoundOrdering</parameter></parameters>
<customMessage>Avoid using CompoundOrdering due to CVE-2018-10237.</customMessage>
</check>

<check customId="byteCountToDisplaySize" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">byteCountToDisplaySize</parameter></parameters>
<customMessage>Use Utils.bytesToString instead of byteCountToDisplaySize for consistency.</customMessage>
Expand Down

0 comments on commit a59941a

Please sign in to comment.