You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2025/01/10 15:22:40 UTC
[PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
dongjoon-hyun opened a new pull request, #49443:
URL: https://github.com/apache/spark/pull/49443
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'common/utils/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "grundprinzip (via GitHub)" <gi...@apache.org>.
grundprinzip commented on code in PR #49443:
URL: https://github.com/apache/spark/pull/49443#discussion_r1910558682
##########
dev/lint-scala:
##########
@@ -17,6 +17,8 @@
# limitations under the License.
#
+set -e
+
Review Comment:
This is a bit of a weird patch. The mvn command should actually continue checking for `$?` and not for the error output being empty. In particular because it parses for "Unformatted files"
Not the second issue is that the lint-scala should not care about the code in
```
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/ExecutorKubernetesCredentialsFeatureStepSuite.scala
```
The mvn command explicitly just checks for
```
-pl sql/api \
-pl sql/connect/common \
-pl sql/connect/server \
-pl connector/connect/client/jvm \
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2582969875
cc @grundprinzip, @HyukjinKwon
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583268267
Let me check my PR once more~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583106365
Please note that `scalastyle` is the following which uses `SBT`. It seems that you are confused with `scalafmt` which uses Maven.
https://github.com/apache/spark/blob/9547a476df1f13fb0c6cd19665247a3fef79bf27/dev/scalastyle#L20-L29
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583283218
To recover master branch, I merged @panbingkun 's PR first because mine is still incomplete.
- #49444
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "grundprinzip (via GitHub)" <gi...@apache.org>.
grundprinzip commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583056476
> I'm not sure why you say like that with `-e`.
>
> > This is a bit of a weird patch. The mvn command should actually continue checking for `$?` and not for the error output being empty. In particular because it parses for "Unformatted files"
> > Not the second issue is that the lint-scala should not care about the code in
> > ```
> > resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/ExecutorKubernetesCredentialsFeatureStepSuite.scala
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > The mvn command explicitly just checks for
> > ```
> > -pl sql/api \
> > -pl sql/connect/common \
> > -pl sql/connect/server \
> > -pl connector/connect/client/jvm \
> > ```
>
> It's a standard way to stop script if some command exist abnormally during the script. Apache Spark utilizes it in many script. Are you aware of it, @grundprinzip ?
>
> ```
> $ git grep 'set -e' | wc -l
> 33
> ```
yes using `-e` exits immediately when any bash command returns a non zero exit code. But this is even true for accessing an undefined variable or so. My point was that I'm not sure why the original command was changed from checking for `$?` to prepping the output.
The main reason for checking for the error is that the goal of the script is to be actionable and have a good error message that the user knows what to do to fix the error. Just failing the command does not help the user to understand how to fix it.
Lastly, my questions still remains why this came up for the `ExecutorKubernetesCredentialsFeatureStepSuite.scala` file because it's not in scope for the scalastyle check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583239929
Could you review this, @panbingkun ? The CI starts to fail at compilation due to this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583299309
I'll revisit this PR later Today.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583377446
This PR is ready back for review.
<img width="296" alt="Screenshot 2025-01-10 at 09 55 02" src="https://github.com/user-attachments/assets/238716dd-36d4-4c70-baea-0171a14b93d6" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "grundprinzip (via GitHub)" <gi...@apache.org>.
grundprinzip commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583262983
Hi @dongjoon-hyun , I was checking the history of the script and it seems it has never failed scalastyle for the past 5 years. See here for example: https://github.com/apache/spark/blob/f0b6245ea4cef0dc61d4277f1d6874ccf315e47a/dev/lint-scala
I'm absolutely in favor of enforcing scalastyle :)
I tested your PR to see if the error message for Spark Connect is still present. If the goal is to enforce Scalastyle then I'm +1 on the PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583265660
Thank you, @grundprinzip . Yes, you are right. Previously, we didn't hit this corner case before.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583957345
Thank you, @grundprinzip , @cnauroth , @viirya .
Merged to master.
There is no previous violation because technically Spark SBT build enforces this if we explicitly skip it by the env variable, `NOLINT_ON_COMPILE`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #49443: [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors
URL: https://github.com/apache/spark/pull/49443
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583025520
I'm not sure why you say like that with `-e`.
> This is a bit of a weird patch. The mvn command should actually continue checking for `$?` and not for the error output being empty. In particular because it parses for "Unformatted files"
>
> Not the second issue is that the lint-scala should not care about the code in
>
> ```
> resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/ExecutorKubernetesCredentialsFeatureStepSuite.scala
> ```
>
> The mvn command explicitly just checks for
>
> ```
> -pl sql/api \
> -pl sql/connect/common \
> -pl sql/connect/server \
> -pl connector/connect/client/jvm \
> ```
It's a standard way to stop script if some command exist abnormally during the script. Apache Spark utilizes it in many script. Are you aware of it, @grundprinzip ?
```
$ git grep 'set -e' | wc -l
33
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583083332
> Just failing the command does not help the user to understand how to fix it.
This sounds like a wrong claim to me. As I mentioned in the PR description, it fails with the rich information like the following.
```
$ dev/lint-scala
Using SPARK_LOCAL_IP=localhost
Scalastyle checks failed at following occurrences:
[error] /Users/dongjoon/APACHE/spark-merge/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/ExecutorKubernetesCredentialsFeatureStepSuite.scala:21:0: There should be no empty line separating imports in the same group.
[error] /Users/dongjoon/APACHE/spark-merge/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/ExecutorKubernetesCredentialsFeatureStepSuite.scala:21:0: io.fabric8.kubernetes.api.model.PodSpec is in wrong order relative to org.scalatest.BeforeAndAfter.
[error] Total time: 16 s, completed Jan 10, 2025, 7:32:59 AM
$ echo $?
1
```
This also looks wrong to me. `ExecutorKubernetesCredentialsFeatureStepSuite.scala` is a Scala code which is in the scope of `scalastyle` script should cover.
> Lastly, my questions still remains why this came up for the ExecutorKubernetesCredentialsFeatureStepSuite.scala file because it's not in scope for the scalastyle check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-50784][TESTS] Fix `lint-scala` not to ignore `scalastyle` errors [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #49443:
URL: https://github.com/apache/spark/pull/49443#issuecomment-2583246424
Also, cc @huaxingao and @viirya . When you have some time, could you review this PR?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org