Skip to content

Commit e7cfd4c

Browse files
Pankraz76Vincent Potucek
andauthored
removeUnusedPrivateMethods (#2)
* RemoveUnusedPrivateMethods * spotless und gradle updateSHAs * spotless und gradle updateSHAs * spotless und gradle updateSHAs * spotless und gradle updateSHAs * spotless und gradle updateSHAs * spotless und gradle updateSHAs * spotless und gradle updateSHAs * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedImports * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * RemoveUnusedPrivateMethods * spot * spot --------- Co-authored-by: Vincent Potucek <vpotucek@me.com>
1 parent 696cd46 commit e7cfd4c

78 files changed

Lines changed: 251 additions & 564 deletions

File tree

Some content is hidden

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

build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,26 @@ import java.nio.charset.StandardCharsets
4848
import static org.opensearch.gradle.util.GradleUtils.maybeConfigure
4949

5050
plugins {
51+
id "test-report-aggregation"
52+
id 'jacoco-report-aggregation'
5153
id 'lifecycle-base'
5254
id 'opensearch.docker-support'
5355
id 'opensearch.global-build-info'
54-
id "com.diffplug.spotless" version "6.25.0" apply false
55-
id "org.openrewrite.rewrite" version "7.11.0" apply false
56+
id "com.diffplug.spotless" version "7.1.0" apply false
5657
id "org.gradle.test-retry" version "1.6.2" apply false
57-
id "test-report-aggregation"
58-
id 'jacoco-report-aggregation'
58+
id "org.openrewrite.rewrite" version "7.11.0" apply false
5959
}
6060

6161
apply from: 'gradle/build-complete.gradle'
62-
apply from: 'gradle/runtime-jdk-provision.gradle'
63-
apply from: 'gradle/ide.gradle'
62+
apply from: 'gradle/code-convention.gradle'
63+
apply from: 'gradle/code-coverage.gradle'
6464
apply from: 'gradle/forbidden-dependencies.gradle'
6565
apply from: 'gradle/formatting.gradle'
66-
apply from: 'gradle/rewrite.gradle'
66+
apply from: 'gradle/ide.gradle'
6767
apply from: 'gradle/local-distribution.gradle'
68-
apply from: 'gradle/run.gradle'
6968
apply from: 'gradle/missing-javadoc.gradle'
70-
apply from: 'gradle/code-coverage.gradle'
69+
apply from: 'gradle/run.gradle'
70+
apply from: 'gradle/runtime-jdk-provision.gradle'
7171

7272
// common maven publishing configuration
7373
allprojects {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1d6eb3e959c737692b720d3492b2f1f34c4c8579

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ org.gradle.caching=true
1414
org.gradle.warning.mode=none
1515
org.gradle.parallel=true
1616
# https://github.com/openrewrite/rewrite-gradle-plugin/issues/212
17-
#org.gradle.workers.max=3
17+
org.gradle.workers.max=3
1818
org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Xss2m \
1919
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
2020
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \

gradle/code-convention.gradle

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*
8+
* Modifications Copyright OpenSearch Contributors. See
9+
* GitHub history for details.
10+
*/
11+
12+
/*
13+
* Licensed to Elasticsearch under one or more contributor
14+
* license agreements. See the NOTICE file distributed with
15+
* this work for additional information regarding copyright
16+
* ownership. Elasticsearch licenses this file to you under
17+
* the Apache License, Version 2.0 (the "License"); you may
18+
* not use this file except in compliance with the License.
19+
* You may obtain a copy of the License at
20+
*
21+
* http://www.apache.org/licenses/LICENSE-2.0
22+
*
23+
* Unless required by applicable law or agreed to in writing,
24+
* software distributed under the License is distributed on an
25+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26+
* KIND, either express or implied. See the License for the
27+
* specific language governing permissions and limitations
28+
* under the License.
29+
*/
30+
31+
import org.opensearch.gradle.BuildPlugin
32+
33+
import static java.lang.System.getenv
34+
35+
allprojects {
36+
plugins.withType(BuildPlugin).whenPluginAdded {
37+
project.apply plugin: "org.openrewrite.rewrite"
38+
rewrite {
39+
activeRecipe("org.opensearch.openrewrite.recipe.CodeCleanup")
40+
configFile = file("$rootDir/gradle/code-convention.yml")
41+
exclusions.add("**OpenSearchTestCaseTests.java")
42+
exclusions.add("**/simple-bulk11.json")
43+
exclusions.add("**/simple-msearch5.json")
44+
exclusions.add("**AbstractBenchmark.java")
45+
exclusions.add("**ScriptClassPathResolutionContext.java")
46+
exclusions.add("**StarTreeMapper.java")
47+
failOnDryRunResults = true
48+
}
49+
repositories {
50+
mavenCentral()
51+
}
52+
dependencies {
53+
rewrite("org.openrewrite.recipe:rewrite-rewrite:0.9.0")
54+
rewrite("org.openrewrite.recipe:rewrite-static-analysis:2.12.0")
55+
}
56+
tasks {
57+
if (getenv("dogFoodDev")) {
58+
assemble {
59+
dependsOn(rewriteRun)
60+
}
61+
}
62+
if (!getenv("skipDogFood")) {
63+
check {
64+
dependsOn(rewriteDryRun)
65+
}
66+
}
67+
}
68+
}
69+
}

gradle/code-convention.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
type: specs.openrewrite.org/v1beta/recipe
2+
name: org.opensearch.openrewrite.recipe.CodeCleanup
3+
displayName: CodeCleanup
4+
description: Automatically cleanup code, e.g. remove unnecessary parentheses, simplify expressions.
5+
recipeList:
6+
- org.openrewrite.java.RemoveUnusedImports
7+
- org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods
8+
# - org.openrewrite.text.EndOfLineAtEndOfFile
9+
# - org.openrewrite.java.OrderImports
10+
# - org.openrewrite.java.format.RemoveTrailingWhitespace
11+
# - org.openrewrite.staticanalysis.EmptyBlock
12+
# - org.openrewrite.staticanalysis.RemoveCallsToSystemGc
13+
# - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables
14+
# - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields
15+
# - org.openrewrite.staticanalysis.UnnecessaryThrows

gradle/formatting.gradle

Lines changed: 45 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -30,81 +30,56 @@
3030

3131
import org.opensearch.gradle.BuildPlugin
3232

33-
/*
34-
* This script plugin configures formatting for Java source using Spotless
35-
* for Gradle. Since the act of formatting existing source can interfere
36-
* with developers' workflows, we don't automatically format all code
37-
* (yet). Instead, we maintain a list of projects that are excluded from
38-
* formatting, until we reach a point where we can comfortably format them
39-
* in one go without too much disruption.
40-
*
41-
* Any new sub-projects must not be added to the exclusions list!
42-
*
43-
* To perform a reformat, run:
44-
*
45-
* ./gradlew spotlessApply
46-
*
47-
* To check the current format, run:
48-
*
49-
* ./gradlew spotlessJavaCheck
50-
*
51-
* This is also carried out by the `precommit` task.
52-
*
53-
* For more about Spotless, see:
54-
*
55-
* https://github.com/diffplug/spotless/tree/master/plugin-gradle
56-
*/
33+
import static java.lang.System.getenv
5734

5835
allprojects {
5936
plugins.withType(BuildPlugin).whenPluginAdded {
60-
project.apply plugin: "com.diffplug.spotless"
61-
62-
spotless {
63-
java {
64-
// Normally this isn't necessary, but we have Java sources in
65-
// non-standard places
66-
target '**/*.java'
67-
68-
importOrder(
69-
'de.thetaphi',
70-
'com.carrotsearch',
71-
'com.fasterxml',
72-
'com.avast',
73-
'com.sun',
74-
'com.maxmind|com.github|com.networknt|groovy|nebula',
75-
'org.antlr',
76-
'software.amazon',
77-
'com.azure|com.microsoft|com.ibm|com.google|joptsimple|org.apache|org.bouncycastle|org.codehaus|org.opensearch|org.objectweb|org.joda|org.hamcrest|org.openjdk|org.gradle|org.junit',
78-
'javax',
79-
'java',
80-
'',
81-
'\\#java|\\#org.opensearch|\\#org.hamcrest|\\#'
82-
)
83-
84-
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('buildSrc/formatterConfig.xml')
85-
endWithNewline()
86-
87-
custom 'Refuse wildcard imports', {
88-
// Wildcard imports can't be resolved; fail the build
89-
if (it =~ /\s+import .*\*;/) {
90-
throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue.")
91-
}
92-
}
93-
94-
// See DEVELOPER_GUIDE.md for details of when to enable this.
95-
if (System.getProperty('spotless.paddedcell') != null) {
96-
paddedCell()
97-
}
37+
project.apply plugin: "com.diffplug.spotless"
38+
spotless {
39+
java {
40+
// Normally this isn't necessary, but we have Java sources in
41+
// non-standard places
42+
target '**/*.java'
43+
importOrder(
44+
'de.thetaphi',
45+
'com.carrotsearch',
46+
'com.fasterxml',
47+
'com.avast',
48+
'com.sun',
49+
'com.maxmind|com.github|com.networknt|groovy|nebula',
50+
'org.antlr',
51+
'software.amazon',
52+
'com.azure|com.microsoft|com.ibm|com.google|joptsimple|org.apache|org.bouncycastle|org.codehaus|org.opensearch|org.objectweb|org.joda|org.hamcrest|org.openjdk|org.gradle|org.junit',
53+
'javax',
54+
'java',
55+
'',
56+
'\\#java|\\#org.opensearch|\\#org.hamcrest|\\#'
57+
)
58+
eclipse().withP2Mirrors(Map.of("https://download.eclipse.org/", "https://mirror.umd.edu/eclipse/")).configFile rootProject.file('buildSrc/formatterConfig.xml')
59+
endWithNewline()
60+
removeWildcardImports()
61+
// See DEVELOPER_GUIDE.md for details of when to enable this.
62+
if (System.getProperty('spotless.paddedcell') != null) {
63+
paddedCell()
9864
}
99-
format 'misc', {
100-
target '*.md', '*.gradle', '**/*.json', '**/*.yaml', '**/*.yml', '**/*.svg'
101-
102-
targetExclude '**/simple-bulk11.json', '**/simple-msearch5.json'
103-
104-
endWithNewline()
65+
}
66+
format 'misc', {
67+
target '*.md', '*.gradle', '**/*.json', '**/*.yaml', '**/*.yml', '**/*.svg'
68+
targetExclude '**/simple-bulk11.json', '**/simple-msearch5.json'
69+
endWithNewline()
70+
}
71+
}
72+
tasks {
73+
if (getenv("dogFoodDev")) {
74+
assemble {
75+
dependsOn(spotlessJavaApply)
10576
}
10677
}
107-
108-
precommit.dependsOn 'spotlessJavaCheck'
78+
if (!getenv("skipDogFood")) {
79+
check {
80+
dependsOn(spotlessJavaCheck)
81+
}
82+
}
83+
}
10984
}
11085
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1d6eb3e959c737692b720d3492b2f1f34c4c8579

libs/task-commons/src/main/java/org/opensearch/task/commons/clients/TaskListRequest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,6 @@ public TaskListRequest taskType(TaskStatus... taskStatus) {
7171
return this;
7272
}
7373

74-
/**
75-
* Update worker node to filter with in the request
76-
* @param workerNode WorkerNode
77-
* @return ListTaskRequest
78-
*/
79-
private TaskListRequest workerNode(WorkerNode workerNode) {
80-
this.workerNodes = workerNode;
81-
return this;
82-
}
83-
8474
/**
8575
* Update page number to start with when fetching the list of tasks
8676
* @param startPageNumber startPageNumber
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1d6eb3e959c737692b720d3492b2f1f34c4c8579
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5286b5df35824b8c2a8ceae9a54e99dca9220e15

0 commit comments

Comments
 (0)