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-48246][BUILD] Add a new ScalaStyle Rule RedundantIfChecker #46546

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

panbingkun
Copy link
Contributor

@panbingkun panbingkun commented May 13, 2024

What changes were proposed in this pull request?

The pr aims to add a new ScalaStyle Rule RedundantIfChecker.

Why are the changes needed?

Make code logic more direct and intuitive.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  • Manually test.
  • Pass GA.

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

No.

@LuciferYang
Copy link
Contributor

@panbingkun Does the Java side have similar rules? There are similar cases in the Java code, for example:

if (type instanceof TimestampType) {
isTimestamp = true;
} else {
isTimestamp = false;
}
if (type instanceof DateType) {
isDate = true;
} else {
isDate = false;
}

@panbingkun
Copy link
Contributor Author

panbingkun commented May 13, 2024

@panbingkun Does the Java side have similar rules? There are similar cases in the Java code, for example:

if (type instanceof TimestampType) {
isTimestamp = true;
} else {
isTimestamp = false;
}
if (type instanceof DateType) {
isDate = true;
} else {
isDate = false;
}

There are similar rules on the java side (SimplifyBooleanExpression & SimplifyBooleanReturn), which I have updated, but unfortunately, it does not recognize the above case.

@panbingkun panbingkun marked this pull request as ready for review May 13, 2024 09:26
@@ -64,4 +64,6 @@
files="src/main/java/org/apache/spark/sql/api/java/*"/>
<suppress checks="IllegalImport"
files="src/test/java/org/apache/spark/sql/hive/test/Complex.java"/>
<suppress checks="SimplifyBooleanExpression"
files="src/test/java/org/apache/spark/sql/hive/test/Complex.java" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants