Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Spotless for formatting #1619

Merged
merged 7 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add groovy block but exclude tests (which is essentially a no-op)
I applied settings in attempt to get as close as I could, but change set is still pretty dramatic and the result is unappealing. (Idea formatting does a better job.)
  • Loading branch information
tylerbenson committed Jun 22, 2020
commit 945ec6716cddb37b04eb44db5a28e782fc749731
12 changes: 6 additions & 6 deletions dd-java-agent/dd-java-agent.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ shadowJar generalShadowJarConfig >> {

manifest {
attributes(
"Main-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Agent-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Premain-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Can-Redefine-Classes": true,
"Can-Retransform-Classes": true,
)
"Main-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Agent-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Premain-Class": "datadog.trace.bootstrap.AgentBootstrap",
"Can-Redefine-Classes": true,
"Can-Retransform-Classes": true,
)
}
}

Expand Down
4 changes: 2 additions & 2 deletions dd-smoke-tests/java9-modules/java9-modules.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ tasks.withType(Test).each {
// Run the jlink command to create the image
exec {
commandLine jlinkExecutable, '--no-man-pages', '--no-header-files',
'--add-modules', 'java.instrument,datadog.smoketest.moduleapp',
"--module-path", "${jdkModulesPath}:" + jar.archiveFile.get().toString(), "--output", generatedImageDir
'--add-modules', 'java.instrument,datadog.smoketest.moduleapp',
"--module-path", "${jdkModulesPath}:" + jar.archiveFile.get().toString(), "--output", generatedImageDir
}
}

Expand Down
8 changes: 8 additions & 0 deletions gradle/enforcement/spotless-groovy.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Disable formatting errors
ignoreFormatterProblems=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.indentation.size=1
org.eclipse.jdt.core.formatter.indentation.text_block_indentation=indent by one
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.continuation_indentation=1
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1
groovy.formatter.longListLength=50
groovy.formatter.multiline.indentation=1
groovy.formatter.remove.unnecessary.semicolons=true
10 changes: 9 additions & 1 deletion gradle/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ spotless {
ktlint().userData(['indent_size': '2', 'continuation_indent_size': '2'])
}

groovy {
excludeJava() // excludes all Java sources within the Groovy source dirs from formatting
// the Groovy Eclipse formatter extends the Java Eclipse formatter,
// so it formats Java files by default (unless `excludeJava` is used).

targetExclude '**/*Test.groovy' // Current formatting configuration is not great for our tests.
greclipse().configFile(project.rootProject.rootDir.path + '/gradle/enforcement/spotless-groovy.properties')
}
scala {
scalafmt()
}
kotlin {
// ktfmt()
// ktfmt() // Requires newer version of java
ktlint().userData(['indent_size': '2', 'continuation_indent_size': '2'])
}

Expand Down