Skip to content

Commit

Permalink
Merge pull request #1 from DevilBotz2876/add_spotless
Browse files Browse the repository at this point in the history
Add spotless code formatter
  • Loading branch information
ParkerMeyers authored Nov 2, 2023
2 parents ba0902e + 0c2015f commit 07a33b8
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id "edu.wpi.first.GradleRIO" version "2023.4.3"
id "idea"
id "com.peterabeles.gversion" version "1.10"
id 'com.diffplug.spotless' version '6.12.0'
}

def javaVersion = JavaVersion.VERSION_11
Expand Down Expand Up @@ -143,4 +144,55 @@ gversion {
dateFormat = "yyyy-MM-dd HH:mm:ss z"
timeZone = "America/New_York" // Use preferred time zone
indent = " "
}

spotless {
ratchetFrom 'origin/main'

java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
toggleOffOn()
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
groovyGradle {
target fileTree('.') {
include '**/*.gradle'
exclude '**/build/**', '**/build-*/**'
}
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
format 'xml', {
target fileTree('.') {
include '**/*.xml'
exclude '**/build/**', '**/build-*/**'
}
eclipseWtp('xml')
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
format 'misc', {
target fileTree('.') {
include '**/*.md', '**/.gitignore'
exclude '**/build/**', '**/build-*/**'
}
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
}

if (!('spotlessCheck' in gradle.startParameter.taskNames)) {
spotlessJavaCheck.enabled = false
spotlessXmlCheck.enabled = false
spotlessMiscCheck.enabled = false
}

0 comments on commit 07a33b8

Please sign in to comment.