-
Notifications
You must be signed in to change notification settings - Fork 3k
Build: Apply spotless for scala code #8023
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| version = 3.9.7 | ||
|
|
||
| align = none | ||
| align.openParenDefnSite = false | ||
| align.openParenCallSite = false | ||
| align.tokens = [] | ||
| importSelectors = "singleLine" | ||
| optIn = { | ||
| configStyleArguments = false | ||
| } | ||
| danglingParentheses.preset = false | ||
| docstrings.style = Asterisk | ||
| docstrings.wrap = false | ||
| maxColumn = 100 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. given that we can fully control this (and since we're deviating from Spark anyway) I think it's fine to set this to 120 or 140 even. Let's see what others think.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have voted for 120.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i merged the pr early, sorry! im happy to help make the change here's the devlist discussion thread eduard has started, https://lists.apache.org/thread/y645tppy9q21xm91qmd582jw0c3jh6hm |
||
| runner.dialect = scala212 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| version = 3.9.7 | ||
|
|
||
| align = none | ||
| align.openParenDefnSite = false | ||
| align.openParenCallSite = false | ||
| align.tokens = [] | ||
| importSelectors = "singleLine" | ||
| optIn = { | ||
| configStyleArguments = false | ||
| } | ||
| danglingParentheses.preset = false | ||
| docstrings.style = Asterisk | ||
| docstrings.wrap = false | ||
| maxColumn = 100 | ||
| runner.dialect = scala213 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,6 +62,21 @@ subprojects { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| removeUnusedImports() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| licenseHeaderFile "$rootDir/.baseline/copyright/copyright-header-java.txt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Configure different scalafmt rules for specific Scala version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (project.name.startsWith("iceberg-spark") && project.name.endsWith("2.13")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to check
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll follow up on this these days
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Submitted #14798 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scala { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target 'src/**/*.scala' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scalafmt("3.9.7").configFile("$rootDir/.baseline/scala/.scala213fmt.conf") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| licenseHeaderFile "$rootDir/.baseline/copyright/copyright-header-java.txt", "package" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (project.name.startsWith("iceberg-spark") && project.name.endsWith("2.12")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scala { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target 'src/**/*.scala' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scalafmt("3.9.7").configFile("$rootDir/.baseline/scala/.scala212fmt.conf") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| licenseHeaderFile "$rootDir/.baseline/copyright/copyright-header-java.txt", "package" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
66
to
79
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
nit capture all
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @kevinjqliu, updated |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked but are these settings resulting in code style that it very close to the Apache Spark codebase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the spark config is here: https://github.com/apache/spark/blob/master/dev/.scalafmt.conf.
The differences:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for learning, why do we deviate for [Imports]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the [Imports] to keep it aligned with Spark. We could add the following if needed:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has been removed from https://github.com/apache/spark/blob/f5b9ea8103dd1f37c6f0cea0692d7bc5b50b778c/dev/.scalafmt.conf
the only difference now is
version(3.8.6vs3.9.7) andmaxColumn(98vs100) anddocstrings.wrap