This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new c97a4b55e1d [SPARK-43714][SQL][TESTS] When formatting 
`error-classes.json` file with `SparkThrowableSuite` , the last line of the 
file should be empty line
c97a4b55e1d is described below

commit c97a4b55e1d2f29e576463dbc822f53e9f86a251
Author: panbingkun <[email protected]>
AuthorDate: Tue May 23 10:36:11 2023 +0300

    [SPARK-43714][SQL][TESTS] When formatting `error-classes.json` file with 
`SparkThrowableSuite` , the last line of the file should be empty line
    
    ### What changes were proposed in this pull request?
    The pr aims to generate a blank line when formatting `error-classes.json` 
file using `SparkThrowableSuite`.
    
    ### Why are the changes needed?
    - When I format `error-classes.json` file using `SparkThrowableSuite`, I 
found the last blank line of the file will be erased, which does not comply 
with universal underlying code specifications, similar:
    python: https://www.flake8rules.com/rules/W391.html
    
    - Promote developer experience.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Manual testing.
    
    Closes #41256 from panbingkun/SPARK-43714.
    
    Authored-by: panbingkun <[email protected]>
    Signed-off-by: Max Gekk <[email protected]>
---
 core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala 
b/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
index f5b5ad2ab10..e9554da082a 100644
--- a/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
+++ b/core/src/test/scala/org/apache/spark/SparkThrowableSuite.scala
@@ -21,6 +21,8 @@ import java.io.File
 import java.nio.charset.StandardCharsets
 import java.nio.file.Files
 
+import scala.util.Properties.lineSeparator
+
 import com.fasterxml.jackson.annotation.JsonInclude.Include
 import com.fasterxml.jackson.core.JsonParser.Feature.STRICT_DUPLICATE_DETECTION
 import com.fasterxml.jackson.core.`type`.TypeReference
@@ -92,7 +94,10 @@ class SparkThrowableSuite extends SparkFunSuite {
         val errorClassesFile = errorJsonFilePath.toFile
         logInfo(s"Regenerating error class file $errorClassesFile")
         Files.delete(errorClassesFile.toPath)
-        FileUtils.writeStringToFile(errorClassesFile, rewrittenString, 
StandardCharsets.UTF_8)
+        FileUtils.writeStringToFile(
+          errorClassesFile,
+          rewrittenString + lineSeparator,
+          StandardCharsets.UTF_8)
       }
     } else {
       assert(rewrittenString.trim == errorClassFileContents.trim)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to