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

[SPARK-50678][BUILD] Clean up outdated style check rules related to Guava #49302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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.
Copy link
Contributor Author

@LuciferYang LuciferYang Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @dongjoon-hyun
Do you think we can clean up these check rules now?
Are there any edge cases that I haven't considered? Thanks

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
Loading