spark icon indicating copy to clipboard operation
spark copied to clipboard

[WIP][SPARK-49401][BUILD] Upgrade `checkstyle` to 10.18.0 & `scalafmt` to 3.8.3

Open panbingkun opened this issue 1 year ago • 1 comments

What changes were proposed in this pull request?

The pr aims to upgrade checkstyle from 10.17.0 to 10.18.0 & scalafmt from 3.8.2 to 3.8.3.

Why are the changes needed?

  • checkstyle https://github.com/checkstyle/checkstyle/releases/tag/checkstyle-10.18.0

  • scalafmt the full release notes: https://github.com/scalameta/scalafmt/releases/tag/v3.8.3

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Manually test.

  • checkstyle
(base) ➜  spark-community git:(SPARK-49401) ✗ sh dev/lint-java
Using `mvn` from path: /Users/panbingkun/Developer/spark/spark-community/build/apache-maven-3.9.9/bin/mvn
-e Checkstyle checks passed.
  • scalafmt 1.negative

    (base) ➜  spark-community git:(SPARK-49401) ✗ git diff
    
    image
    (base) ➜  spark-community git:(SPARK-49401) ✗ sh dev/scalastyle
    -e Scalastyle checks failed at following occurrences:
    [error] /Users/panbingkun/Developer/spark/spark-community/connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroSerializer.scala:166:8: Are you sure you want to println? If yes, wrap the code block with
    [error]       // scalastyle:off println
    [error]       println(...)
    [error]       // scalastyle:on println
    [error] Total time: 20 s, completed Aug 27, 2024, 9:28:54 AM
    (base) ➜  spark-community git:(SPARK-49401)
    

    2.positive

    (base) ➜  spark-community git:(SPARK-49401) ✗ git diff
    
    image
    (base) ➜  spark-community git:(SPARK-49401) ✗ sh dev/scalastyle
    -e Scalastyle checks passed.
    (base) ➜  spark-community git:(SPARK-49401) ✗
    

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

No.

panbingkun avatar Aug 27 '24 01:08 panbingkun

Let me restore the changes to the scalafmt. The case is as follows:

  • Before image

  • After image

Obviously, using the 3.8.3 version of scalafmt, the formatting code is incorrect. I will raise an issue to the scalafmt community: https://github.com/scalameta/scalafmt/issues/4187

panbingkun avatar Aug 27 '24 03:08 panbingkun