Skip to content

Commit b2e1ea3

Browse files
committed
build: use Google style with Palantir
1 parent 7e70daf commit b2e1ea3

7 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ docs/ Developer documentation (see below)
5151
./gradlew :dd-java-agent:shadowJar # Build agent jar only (dd-java-agent/build/libs/)
5252
./gradlew :path:to:module:test # Run tests for a specific module
5353
./gradlew :path:to:module:test -PtestJvm=11 # Test on a specific JVM version
54-
./gradlew spotlessApply # Auto-format code (Palantir Java Format)
54+
./gradlew spotlessApply # Auto-format code (Palantir Java Format, GOOGLE style)
5555
./gradlew spotlessCheck # Verify formatting
5656
```
5757

5858
## Code conventions
5959

60-
- **Formatting**: Palantir Java Format enforced via Spotless. Run `./gradlew spotlessApply` before committing.
60+
- **Formatting**: Palantir Java Format with `GOOGLE` style enforced via Spotless. Run `./gradlew spotlessApply` before committing.
6161
- **Static imports**: Prefer static imports over class-qualified calls for call-style helpers, in both test (Assertions.assertEquals, Mockito.mock) and production code (Collections.emptyList). Wildcard imports disallowed — see CONTRIBUTING.md.
6262
- **Documentation**: Use concise Javadoc comments (`/** ... */`) for class, method, and field documentation.
6363
- **Instrumentation layout**: `dd-java-agent/instrumentation/{framework}/{framework}-{minVersion}/`

‎CONTRIBUTING.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ We have automatic code formatting enabled in Gradle configuration using [Spotles
3434
Our main goal is to avoid extensive reformatting caused by different IDEs with different opinions about how things should
3535
be formatted by establishing a single _point of truth_.
3636

37-
Java sources use [Palantir Java Format](https://github.com/palantir/palantir-java-format) with its default `PALANTIR`
38-
style: four-space indentation and a 120-character line width.
37+
Java sources use [Palantir Java Format](https://github.com/palantir/palantir-java-format) with its `GOOGLE` style:
38+
two-space indentation and a 100-character line width.
3939

4040
To reformat all the files that need reformatting:
4141

@@ -64,8 +64,9 @@ For IntelliJ IDEA, we suggest the following settings and plugin.
6464
* `Class count to use import with '*'`: `9999` (some number sufficiently large that is unlikely to matter)
6565
* `Names count to use static import with '*'`: `9999`
6666
* To run test in a specific JDK use the `testJvm` property, e.g. `-PtestJvm=11`
67-
* Install the [Palantir Java Format](https://plugins.jetbrains.com/plugin/13180-palantir-java-format) plugin
68-
* In IntelliJ IDEA settings, search for `palantir-java-format` and enable it for the current project
67+
* Format Java sources with the Spotless Gradle tasks above. Do not enable the
68+
[Palantir Java Format](https://plugins.jetbrains.com/plugin/13180-palantir-java-format) plugin for this project: it
69+
currently exposes only the default `PALANTIR` style, while this project uses `GOOGLE`.
6970

7071
### Static imports
7172

‎build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
4141
removeUnusedImports()
4242
forbidWildcardImports()
4343

44-
palantirJavaFormat(libs.versions.palantir.java.format.get())
44+
palantirJavaFormat(libs.versions.palantir.java.format.get()).style("GOOGLE")
4545
tableTestFormatter(libs.versions.tabletest.formatter.get())
4646
}
4747
groovyGradle {

‎buildSrc/call-site-instrumentation-plugin/build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spotless {
2222
targetExclude("src/test/resources/**")
2323
removeUnusedImports()
2424
forbidWildcardImports()
25-
palantirJavaFormat(libs.versions.palantir.java.format.get())
25+
palantirJavaFormat(libs.versions.palantir.java.format.get()).style("GOOGLE")
2626
}
2727
}
2828

‎buildSrc/modifiable-config-agent/build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spotless {
1818
targetExclude("src/test/resources/**")
1919
removeUnusedImports()
2020
forbidWildcardImports()
21-
palantirJavaFormat(libs.versions.palantir.java.format.get())
21+
palantirJavaFormat(libs.versions.palantir.java.format.get()).style("GOOGLE")
2222
}
2323
}
2424

‎gradle/spotless.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spotless {
4949
targetExclude('src/test/resources/**', buildDirectory)
5050
removeUnusedImports()
5151
forbidWildcardImports()
52-
palantirJavaFormat(libs.versions.palantir.java.format.get())
52+
palantirJavaFormat(libs.versions.palantir.java.format.get()).style("GOOGLE")
5353
tableTestFormatter(libs.versions.tabletest.formatter.get())
5454
}
5555
}

‎test-published-dependencies/build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ allprojects {
3737
target("src/**/*.java")
3838
removeUnusedImports()
3939
forbidWildcardImports()
40-
palantirJavaFormat(libs.versions.palantir.java.format.get())
40+
palantirJavaFormat(libs.versions.palantir.java.format.get()).style("GOOGLE")
4141
}
4242
}
4343
}

0 commit comments

Comments
 (0)