Skip to content

Commit e645a51

Browse files
authored
Merge pull request #288 from Bit-Quill/dev/spotless
Adds Spotless code formatter
2 parents f92e48c + 18a75bd commit e645a51

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

DEVELOPER_GUIDE.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ Note that missing license header will be detected by Gradle license plugin and f
113113
Making Code Changes
114114
===================
115115

116-
Project Strucure
117-
----------------
116+
Project Structure
117+
-----------------
118118

119119
The plugin codebase is in standard layout of Gradle project::
120120

@@ -226,6 +226,10 @@ Most of the time you just need to run ./gradlew build which will make sure you p
226226
- Build plugin by run all tasks above (this takes time).
227227
* - ./gradlew pitest
228228
- Run PiTest mutation testing (see more info in `#1204 <https://github.com/opensearch-project/sql/pull/1204>`_)
229+
* - ./gradlew spotlessCheck
230+
- Runs Spotless to check for code style.
231+
* - ./gradlew spotlessApply
232+
- Automatically apply spotless code style changes.
229233

230234
For integration test, you can use ``-Dtests.class`` “UT full path” to run a task individually. For example ``./gradlew :integ-test:integTest -Dtests.class="*QueryIT"``.
231235

build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ plugins {
6565
id 'checkstyle'
6666
id "io.freefair.lombok" version "6.4.0"
6767
id 'jacoco'
68+
id 'com.diffplug.spotless' version '6.19.0'
6869
}
6970

7071
// import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94
@@ -79,6 +80,25 @@ repositories {
7980
maven { url 'https://jitpack.io' }
8081
}
8182

83+
// Spotless checks will be added as PRs are applied to resolve each style issue is approved.
84+
spotless {
85+
java {
86+
// target fileTree('.') {
87+
// include '**/*.java', 'src/*/java/**/*.java'
88+
// exclude '**/build/**', '**/build-*/**'
89+
// }
90+
// importOrder()
91+
// licenseHeader("/*\n" +
92+
// " * Copyright OpenSearch Contributors\n" +
93+
// " * SPDX-License-Identifier: Apache-2.0\n" +
94+
// " */\n\n\n")
95+
// removeUnusedImports()
96+
// trimTrailingWhitespace()
97+
// endWithNewline()
98+
// googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
99+
}
100+
}
101+
82102
allprojects {
83103
version = opensearch_version.tokenize('-')[0] + '.0'
84104
if (buildVersionQualifier) {

0 commit comments

Comments
 (0)