Skip to content

Commit 45002a7

Browse files
Fix jdt formatter error (opensearch-project#4151)
* Fix jdt formatter error Signed-off-by: Nathalie Jonathan <[email protected]> * Fix file name Signed-off-by: Nathalie Jonathan <[email protected]> * Refactor spotless Signed-off-by: Nathalie Jonathan <[email protected]> --------- Signed-off-by: Nathalie Jonathan <[email protected]>
1 parent be945ca commit 45002a7

File tree

11 files changed

+25
-71
lines changed

11 files changed

+25
-71
lines changed

build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ buildscript {
4141
dependencies {
4242
classpath "${opensearch_group}.gradle:build-tools:${opensearch_version}"
4343
classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.5"
44+
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.25.0"
4445
configurations.all {
4546
resolutionStrategy {
4647
force("org.eclipse.platform:org.eclipse.core.runtime:3.29.0") // for spotless transitive dependency CVE (for 3.26.100)
@@ -97,6 +98,16 @@ subprojects {
9798
resolutionStrategy.force "com.google.guava:guava:32.1.3-jre"
9899
resolutionStrategy.force 'org.apache.commons:commons-compress:1.26.0'
99100
}
101+
102+
apply plugin: 'com.diffplug.spotless'
103+
104+
spotless {
105+
java {
106+
removeUnusedImports()
107+
importOrder 'java', 'javax', 'org', 'com'
108+
eclipse().configFile rootProject.file('.eclipseformat.xml')
109+
}
110+
}
100111
}
101112

102113
ext {

client/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ plugins {
99
id 'jacoco'
1010
id 'io.github.goooler.shadow' version "8.1.7"
1111
id 'maven-publish'
12-
id 'com.diffplug.spotless' version '6.25.0'
1312
id 'signing'
1413
}
1514

@@ -23,15 +22,6 @@ dependencies {
2322

2423
}
2524

26-
spotless {
27-
java {
28-
removeUnusedImports()
29-
importOrder 'java', 'javax', 'org', 'com'
30-
31-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
32-
}
33-
}
34-
3525
jacocoTestReport {
3626
reports {
3727
xml.getRequired().set(true)

common/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ plugins {
99
id 'io.github.goooler.shadow' version "8.1.7"
1010
id 'jacoco'
1111
id "io.freefair.lombok"
12-
id 'com.diffplug.spotless' version '6.25.0'
1312
id 'maven-publish'
1413
id 'signing'
1514
}
@@ -77,15 +76,6 @@ jacocoTestCoverageVerification {
7776
}
7877
check.dependsOn jacocoTestCoverageVerification
7978

80-
spotless {
81-
java {
82-
removeUnusedImports()
83-
importOrder 'java', 'javax', 'org', 'com'
84-
85-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
86-
}
87-
}
88-
8979
shadowJar {
9080
destinationDirectory = file("${project.buildDir}/distributions")
9181
archiveClassifier.set(null)

memory/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ plugins {
2020
id 'java'
2121
id 'jacoco'
2222
id "io.freefair.lombok"
23-
id 'com.diffplug.spotless' version '6.25.0'
2423
}
2524

2625
dependencies {
@@ -81,12 +80,3 @@ jacocoTestCoverageVerification {
8180
dependsOn jacocoTestReport
8281
}
8382
check.dependsOn jacocoTestCoverageVerification
84-
85-
spotless {
86-
java {
87-
removeUnusedImports()
88-
importOrder 'java', 'javax', 'org', 'com'
89-
90-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
91-
}
92-
}

ml-algorithms/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ plugins {
1010
id 'java-library'
1111
id 'jacoco'
1212
id "io.freefair.lombok"
13-
id 'com.diffplug.spotless' version '6.25.0'
1413
}
1514

1615
repositories {
@@ -136,12 +135,3 @@ jacocoTestCoverageVerification {
136135
}
137136
check.dependsOn jacocoTestCoverageVerification
138137
compileJava.dependsOn(':opensearch-ml-common:shadowJar')
139-
140-
spotless {
141-
java {
142-
removeUnusedImports()
143-
importOrder 'java', 'javax', 'org', 'com'
144-
145-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
146-
}
147-
}

plugin/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ plugins {
1313
id "io.freefair.lombok"
1414
id 'jacoco'
1515
id 'java-library'
16-
id 'com.diffplug.spotless' version '6.25.0'
1716
}
1817

1918
ext {
@@ -482,15 +481,6 @@ afterEvaluate {
482481
}
483482
}
484483

485-
spotless {
486-
java {
487-
removeUnusedImports()
488-
importOrder 'java', 'javax', 'org', 'com'
489-
490-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
491-
}
492-
}
493-
494484
tasks.withType(licenseHeaders.class) {
495485
additionalLicense 'AL ', 'Apache', 'Licensed under the Apache License, Version 2.0 (the "License")'
496486
}

search-processors/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ plugins {
1919
id 'java'
2020
id 'jacoco'
2121
id "io.freefair.lombok"
22-
id 'com.diffplug.spotless' version '6.25.0'
2322
}
2423

2524
repositories {
@@ -74,12 +73,3 @@ jacocoTestCoverageVerification {
7473
}
7574

7675
check.dependsOn jacocoTestCoverageVerification
77-
78-
spotless {
79-
java {
80-
removeUnusedImports()
81-
importOrder 'java', 'javax', 'org', 'com'
82-
83-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('.eclipseformat.xml')
84-
}
85-
}

spi/src/main/java/org/opensearch/ml/common/spi/MLCommonsExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
package org.opensearch.ml.common.spi;
77

8-
import org.opensearch.ml.common.spi.tools.Tool;
9-
108
import java.util.List;
119

10+
import org.opensearch.ml.common.spi.tools.Tool;
11+
1212
/**
1313
* ml-commons extension interface.
1414
*/

spi/src/main/java/org/opensearch/ml/common/spi/memory/Memory.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
package org.opensearch.ml.common.spi.memory;
77

8-
import org.opensearch.core.action.ActionListener;
9-
108
import java.util.Map;
119

10+
import org.opensearch.core.action.ActionListener;
11+
1212
/**
1313
* A general memory interface.
1414
* @param <T>
@@ -28,15 +28,18 @@ public interface Memory<T extends Message> {
2828
*/
2929
default void save(String id, T message) {}
3030

31-
default <S> void save(String id, T message, ActionListener<S> listener){}
31+
default <S> void save(String id, T message, ActionListener<S> listener) {}
3232

3333
/**
3434
* Get messages of memory id.
3535
* @param id memory id
3636
* @return
3737
*/
38-
default T[] getMessages(String id){return null;}
39-
default void getMessages(String id, ActionListener<T> listener){}
38+
default T[] getMessages(String id) {
39+
return null;
40+
}
41+
42+
default void getMessages(String id, ActionListener<T> listener) {}
4043

4144
/**
4245
* Clear all memory.

spi/src/main/java/org/opensearch/ml/common/spi/tools/Tool.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55

66
package org.opensearch.ml.common.spi.tools;
77

8-
import org.opensearch.core.action.ActionListener;
9-
108
import java.util.Collections;
11-
import java.util.HashMap;
129
import java.util.Map;
1310

11+
import org.opensearch.core.action.ActionListener;
12+
1413
/**
1514
* General tool interface.
1615
*/
@@ -68,7 +67,9 @@ public interface Tool {
6867
String getDescription();
6968

7069
Map<String, Object> getAttributes();
70+
7171
void setAttributes(Map<String, Object> attributes);
72+
7273
/**
7374
* Set tool description.
7475
* @param description the description to set

0 commit comments

Comments
 (0)