>The inconsistency with style across different files is sad
Yep. And to be clear I am not against an effort to unify the file style.
Two tests attached as the following:
(this is the test that replace the blank line with random string, and
spotless just throw exception)
$git diff
diff --git
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
index 29e0d30112..d46742bf45 100644
---
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
+++
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
@@ -15,6 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+dsfdsfdsafds
/** BeamSQL provides a new interface to run a SQL statement with Beam. */
package org.apache.beam.sdk.extensions.sql;
$./gradlew :sdks:java:extensions:sql:spotlessCheck
> Task :sdks:java:extensions:sql:spotlessJava FAILED
Step 'google-java-format' found problem in
'sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java':
null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
(this is the test that insert one more blank line so in total there are two
blank lines)
$git diff
diff --git
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
index 29e0d30112..c0049ac2cb 100644
---
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
+++
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
@@ -16,5 +16,6 @@
* limitations under the License.
*/
+
/** BeamSQL provides a new interface to run
package org.apache.beam.sdk.extensions.sql;
$./gradlew :sdks:java:extensions:sql:spotlessCheck
> Task :sdks:java:extensions:sql:spotlessJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sdks:java:extensions:sql:spotlessJava'.
> The following files had format violations:
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/package-info.java
@@ -16,6 +16,5 @@
·*·limitations·under·the·License.
·*/
-
/**·BeamSQL·provides·a·new·interface·to·run·a·SQL·statement·with·Beam.·*/
package·org.apache.beam.sdk.extensions.sql;
Run 'gradlew spotlessApply' to fix these violations.
-Rui
On Mon, Dec 9, 2019 at 10:44 AM Vladimir Sitnikov <
[email protected]> wrote:
> >has one blank line after copyright
>
> Beam seems to have mixed style as well:
> blank line before "package":
>
> https://github.com/apache/beam/blob/166c6de33f2491c4c9bd27511cc71e33f8d2a894/buildSrc/src/main/groovy/org/apache/beam/gradle/GrpcVendoring.groovy#L18
> no blank before "package":
>
> https://github.com/apache/beam/blob/a2b0ad14f1525d1a645cb26f5b8ec45692d9d54e/examples/java/src/main/java/org/apache/beam/examples/subprocess/configuration/SubProcessConfiguration.java#L17-L18
>
> The inconsistency with style across different files is sad.
>
> >I did a test.
>
> Did you use package-info.java for the test?
>
> Here's my test:
> $ git diff
> diff --git
> a/kafka/src/main/java/org/apache/calcite/adapter/kafka/package-info.java
> b/kafka/src/main/java/org/apache/calcite/adapter/kafka/package-info.java
> index 8805de348..77f66752d 100644
> ---
> a/kafka/src/main/java/org/apache/calcite/adapter/kafka/package-info.java
> +++
> b/kafka/src/main/java/org/apache/calcite/adapter/kafka/package-info.java
> @@ -1,7 +1,6 @@
> /*
> * 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.
> + asdf lkasjhdf lkasjdhf lkasjhdlk h
> * 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
>
> $ gw :kafka:spotlessCheck
> Building Apache Calcite 1.22.0-SNAPSHOT
> ...
> BUILD SUCCESSFUL in 1s
> 2 actionable tasks: 1 executed, 1 up-to-date
>
> Vladimir
>