Skip to content

Commit f9cd7ee

Browse files
authored
Add spotless precommit hook + license check (#4306)
* Add spotless precommit hook Signed-off-by: Simeon Widdis <[email protected]> * Decouple plugin spotless versions + upgrade spotless Signed-off-by: Simeon Widdis <[email protected]> * Enable license headers everywhere Signed-off-by: Simeon Widdis <[email protected]> * Remove a redundant comment Signed-off-by: Simeon Widdis <[email protected]> * Fix removed additional licenses Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]>
1 parent 0e5802b commit f9cd7ee

File tree

115 files changed

+268
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+268
-431
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: spotless-check
5+
name: Spotless Check
6+
entry: ./gradlew spotlessCheck
7+
language: system
8+
pass_filenames: false

async-query-core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
id "io.freefair.lombok"
99
id 'jacoco'
1010
id 'antlr'
11-
id 'com.diffplug.spotless' version '6.22.0'
11+
id 'com.diffplug.spotless'
1212
id 'com.gradleup.shadow'
1313
}
1414

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ plugins {
8181
id 'java-library'
8282
id "io.freefair.lombok" version "8.14"
8383
id 'jacoco'
84-
id 'com.diffplug.spotless' version '6.22.0'
84+
id 'com.diffplug.spotless' version '7.2.1'
8585
}
8686

8787
// import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94
@@ -105,10 +105,10 @@ spotless {
105105
exclude '**/build/**', '**/build-*/**', '**/gen/**'
106106
}
107107
importOrder()
108-
// licenseHeader("/*\n" +
109-
// " * Copyright OpenSearch Contributors\n" +
110-
// " * SPDX-License-Identifier: Apache-2.0\n" +
111-
// " */\n\n")
108+
licenseHeader("/*\n" +
109+
" * Copyright OpenSearch Contributors\n" +
110+
" * SPDX-License-Identifier: Apache-2.0\n" +
111+
" */\n\n")
112112
removeUnusedImports()
113113
trimTrailingWhitespace()
114114
endWithNewline()

common/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
plugins {
2626
id 'java-library'
2727
id "io.freefair.lombok"
28-
id 'com.diffplug.spotless' version '6.22.0'
28+
id 'com.diffplug.spotless'
2929
}
3030

3131
repositories {
@@ -73,11 +73,10 @@ spotless {
7373
exclude '**/build/**', '**/build-*/**'
7474
}
7575
importOrder()
76-
// Needs https://github.com/opensearch-project/sql/issues/1893 to be addressed first
77-
// licenseHeader("/*\n" +
78-
// " * Copyright OpenSearch Contributors\n" +
79-
// " * SPDX-License-Identifier: Apache-2.0\n" +
80-
// " */\n\n")
76+
licenseHeader("/*\n" +
77+
" * Copyright OpenSearch Contributors\n" +
78+
" * SPDX-License-Identifier: Apache-2.0\n" +
79+
" */\n\n")
8180
removeUnusedImports()
8281
trimTrailingWhitespace()
8382
endWithNewline()

common/src/main/java/org/opensearch/sql/common/antlr/Parser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package org.opensearch.sql.common.antlr;
27

38
import org.antlr.v4.runtime.tree.ParseTree;

common/src/main/java/org/opensearch/sql/common/interceptors/AwsSigningInterceptor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/*
2-
*
3-
* * Copyright OpenSearch Contributors
4-
* * SPDX-License-Identifier: Apache-2.0
5-
*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
64
*/
75

86
package org.opensearch.sql.common.interceptors;

common/src/main/java/org/opensearch/sql/common/interceptors/BasicAuthenticationInterceptor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/*
2-
*
3-
* * Copyright OpenSearch Contributors
4-
* * SPDX-License-Identifier: Apache-2.0
5-
*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
64
*/
75

86
package org.opensearch.sql.common.interceptors;

common/src/main/java/org/opensearch/sql/common/interceptors/URIValidatorInterceptor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/*
2-
*
3-
* * Copyright OpenSearch Contributors
4-
* * SPDX-License-Identifier: Apache-2.0
5-
*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
64
*/
75

86
package org.opensearch.sql.common.interceptors;

common/src/main/java/org/opensearch/sql/common/utils/URIValidationUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package org.opensearch.sql.common.utils;
27

38
import inet.ipaddr.IPAddressString;

common/src/test/java/org/opensearch/sql/common/interceptors/AwsSigningInterceptorTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/*
2-
*
3-
* * Copyright OpenSearch Contributors
4-
* * SPDX-License-Identifier: Apache-2.0
5-
*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
64
*/
75

86
package org.opensearch.sql.common.interceptors;

0 commit comments

Comments
 (0)