-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Apply baseline checkstyle for iceberg-api only #28
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
Conversation
|
One thing that's tricky about applying this to |
They take up a lot of space and we can choose to add eclipse support later
|
I think most of the changes are fine, but I noticed a few things:
I like the updates for:
Does this enforce a line length of 100 characters? Why does this require so many Palantir plugins? Are those required? |
|
@rdblue thanks for the review!
Per Google's style guide (actually much of Baseline inherits the Google style guide). Edit: Think it's fine if we want to be opinionated about moving static imports to be after non-static if we want to minimize code churn. In the long term it would be good to think about changing the import order to be consistent with the Google style guide.
Fair enough, let's add exclusions as we see fit. I already added some exclusion, I believe for literals and operators. We can add them for expressions as well. I don't think we want to allow static imports globally though, it leads to difficulty to trace a method call back to its source without an IDE (i.e. in CR).
That's what checkstyle should be supporting with this patch though? There were some that moved the core JDK imports into the main import block. I'll double check.
Fair enough. Baseline wants to enforce camelCase for everything, so names with consecutive capital letters are not allowed. See here and here. We can add an exclusion for
Baseline's checkstyle requires all variables to not hide fields. This meant that for
It's for the
I think we want to only enforce one or the other; we can find how to make the regex enforce the operators to be on the same line rather than on the next. Or we can just start making all operators move to the next line, as we do here.
120 characters by default.
These are all Palantir's open-source tooling! Granted one can get all of them automatically applied by just applying the |
| @@ -0,0 +1,461 @@ | |||
| <project version="4"> | |||
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.
@iamdanfox would it be reasonable to allow the name of this file to be configurable? I was looking at the Baseline source code and the file name is hardcoded to this path. But including a reference to Palantir seems strange for projects that want to use baseline that don't find their origins with Palantir itself.
What I'd like to do instead is to run ./gradlew baselineUpdateConfig to get this template, but then be able to rename this file and reference the renamed path in build.gradle.
|
I think we should get this in, but I'd like to try to do it when we move from com.netflix packages to org.apache. That is going to touch every file as well, so we may as well do it at the same time. |
|
What's the timeline for that? Should we start doing both sets of changes now? |
|
I don't have a timeline yet, but I'd like to get it done in the next few weeks. I've added blocking issues to the 0.1.0 release milestone. |
|
Let's prepare to do this after #69 |
|
I'm closing this in preparation for rewriting this against the most up to date |
…nov-15 Merge Iceberg master as of Nov 15
…cked Iceberg Parquet table (apache#28)
An experimental proposition for standardizing style across the Iceberg project.
Part of, but not all, #24
Previously, whenever styles were inconsistent across the Iceberg codebase, it was up to code reviewers to catch the inconsistencies and to catch them before merging. This is prone to error, and little code linting problems can add up over time.
Baseline is a code linting toolkit for Gradle. It consists of multiple submodules that when taken together allow automation to enforce consistent coding guidelines. For more information, refer to the Baseline docs.
As a proof of concept, checkstyle is now only applied for the iceberg-api project, while IntelliJ project configuration is applied for all projects. We apply checkstyle changes only to iceberg-api to minimize code churn and to show how we can introduce baseline checks incrementally. Eventually we can add the same checkstyle rules for each submodule, and also, if we desire, apply the other baseline plugins to get additional linting capabilities such as Findbugs and error-prone.
Some opinions that baseline holds, which were often not in line with what Iceberg did - these include, but are not limited to:
Any of the above and others can be changed according to whatever we see fit. In this PR we've specifically adjusted some of the checkstyle rules to be more consistent with what the codebase has historically held to. These include, but are not limited to:
@returnsannotation.For IntelliJ, the baseline plugin allows the IntelliJ project to be configured via
./gradlew ideawith the following desirable settings, regardless of the developer's local IntelliJ settings for their other projects:We lastly note that baseline is not the only way to automate linting. Its main advantage is that it is very comprehensive. But the opinions it holds are numerous, and we can feel free to reject this proposal in favor of developing our own opinions from scratch.