Skip to content

Commit 4caa8f9

Browse files
Copilottrask
andcommitted
Sync spotless configuration with opentelemetry-java-instrumentation (#95)
* Initial plan * Sync spotless configuration with opentelemetry-java-instrumentation Co-authored-by: trask <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: trask <[email protected]>
1 parent 54e7c28 commit 4caa8f9

File tree

3 files changed

+200
-121
lines changed

3 files changed

+200
-121
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ The agent JAR is built in **3 critical steps** (see `agent/agent/build.gradle.kt
9090
abstract class HttpClientTest {
9191
@Environment(TOMCAT_8_JAVA_8)
9292
static class Tomcat8Java8Test extends HttpClientTest {}
93-
93+
9494
@Environment(TOMCAT_8_JAVA_11)
9595
static class Tomcat8Java11Test extends HttpClientTest {}
9696
}
Lines changed: 110 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,123 @@
1+
import com.diffplug.gradle.spotless.SpotlessExtension
2+
13
plugins {
24
id("com.diffplug.spotless")
35
}
46

57
spotless {
68
java {
79
googleJavaFormat()
8-
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|public|// Includes work from:)")
10+
licenseHeaderFile(
11+
rootProject.file("buildscripts/spotless.license.java"),
12+
"(package|import|public|// Includes work from:)"
13+
)
14+
toggleOffOn()
915
target("src/**/*.java")
1016
}
17+
plugins.withId("groovy") {
18+
groovy {
19+
licenseHeaderFile(
20+
rootProject.file("buildscripts/spotless.license.java"),
21+
"(package|import|(?:abstract )?class)"
22+
)
23+
endWithNewline()
24+
}
25+
}
26+
plugins.withId("scala") {
27+
scala {
28+
scalafmt()
29+
licenseHeaderFile(
30+
rootProject.file("buildscripts/spotless.license.java"),
31+
"(package|import|public)"
32+
)
33+
target("src/**/*.scala")
34+
}
35+
}
36+
plugins.withId("org.jetbrains.kotlin.jvm") {
37+
kotlin {
38+
// not sure why it's not using the indent settings from .editorconfig
39+
ktlint().editorConfigOverride(
40+
mapOf(
41+
"indent_size" to "2",
42+
"continuation_indent_size" to "2",
43+
"max_line_length" to "160",
44+
"ktlint_standard_no-wildcard-imports" to "disabled",
45+
"ktlint_standard_package-name" to "disabled",
46+
// ktlint does not break up long lines, it just fails on them
47+
"ktlint_standard_max-line-length" to "disabled",
48+
// ktlint makes it *very* hard to locate where this actually happened
49+
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
50+
// depends on ktlint_standard_wrapping
51+
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
52+
// also very hard to find out where this happens
53+
"ktlint_standard_wrapping" to "disabled"
54+
)
55+
)
56+
licenseHeaderFile(
57+
rootProject.file("buildscripts/spotless.license.java"),
58+
"(package|import|class|// Includes work from:)"
59+
)
60+
}
61+
}
1162
kotlinGradle {
12-
ktlint().editorConfigOverride(mapOf(
13-
"indent_size" to "2",
14-
"continuation_indent_size" to "2",
15-
"max_line_length" to "160",
16-
"ktlint_standard_no-wildcard-imports" to "disabled",
17-
// ktlint does not break up long lines, it just fails on them
18-
"ktlint_standard_max-line-length" to "disabled",
19-
// ktlint makes it *very* hard to locate where this actually happened
20-
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
21-
// depends on ktlint_standard_wrapping
22-
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
23-
// also very hard to find out where this happens
24-
"ktlint_standard_wrapping" to "disabled"
25-
))
63+
// not sure why it's not using the indent settings from .editorconfig
64+
ktlint().editorConfigOverride(
65+
mapOf(
66+
"indent_size" to "2",
67+
"continuation_indent_size" to "2",
68+
"max_line_length" to "160",
69+
"ktlint_standard_no-wildcard-imports" to "disabled",
70+
// ktlint does not break up long lines, it just fails on them
71+
"ktlint_standard_max-line-length" to "disabled",
72+
// ktlint makes it *very* hard to locate where this actually happened
73+
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
74+
// depends on ktlint_standard_wrapping
75+
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
76+
// also very hard to find out where this happens
77+
"ktlint_standard_wrapping" to "disabled",
78+
// we use variable names like v1_10Deps
79+
"ktlint_standard_property-naming" to "disabled",
80+
// prevent moving comment to next line in latestDepTestLibrary("xxx") { // see xxx module
81+
"ktlint_standard_function-literal" to "disabled"
82+
)
83+
)
2684
}
27-
format("misc") {
28-
// not using "**/..." to help keep spotless fast
29-
target(
30-
".gitattributes",
31-
".gitconfig",
32-
".editorconfig",
33-
"*.md",
34-
"src/**/*.md",
35-
"docs/**/*.md",
36-
"*.sh",
37-
"src/**/*.properties")
38-
leadingTabsToSpaces()
39-
trimTrailingWhitespace()
40-
endWithNewline()
85+
}
86+
87+
// Use root declared tool deps to avoid issues with high concurrency.
88+
// see https://github.com/diffplug/spotless/tree/main/plugin-gradle#dependency-resolution-modes
89+
if (project == rootProject) {
90+
spotless {
91+
format("misc") {
92+
target(
93+
".gitignore",
94+
".gitattributes",
95+
".gitconfig",
96+
".editorconfig",
97+
"**/*.md",
98+
"**/*.sh",
99+
"**/*.dockerfile",
100+
"**/gradle.properties"
101+
)
102+
leadingTabsToSpaces()
103+
trimTrailingWhitespace()
104+
endWithNewline()
105+
}
106+
predeclareDeps()
107+
}
108+
109+
with(extensions["spotlessPredeclare"] as SpotlessExtension) {
110+
java {
111+
googleJavaFormat()
112+
}
113+
scala {
114+
scalafmt()
115+
}
116+
kotlin {
117+
ktlint()
118+
}
119+
kotlinGradle {
120+
ktlint()
121+
}
41122
}
42123
}

0 commit comments

Comments
 (0)