Spotless
- Spotless: Keep your code spotless
- Junit5์์ ์ปจ๋ฒค์
์ ์งํค๊ณ ์ฝ๊ฒ ์ ์ง๋ณด์ํ๊ธฐ ์ํด ์ฌ์ฉํ๋ ํ๋ฌ๊ทธ์ธ
Install Guide
plugins {
id "com.diffplug.gradle.spotless" version "3.28.1"
}
Setting Guide
spotless {
java {
// ์ฌ์ฉํ์ง ์๋ import ์ ๊ฑฐ
removeUnusedImports()
// ๊ณต๋ฐฑ ์ ๊ฑฐ
trimTrailingWhitespace()
// Tab์ผ๋ก ์ฒ๋ฆฌ(ํ๋ผ๋ฏธํฐ์ ์ซ์๋ฅผ ๋ฃ์ผ๋ฉด )
indentWithTabs()
// ๋๋ถ๋ถ NewLine ์ฒ๋ฆฌ
endWithNewline()
/**
* ์๋์ผ๋ก ๋ผ์ด์ผ์ค ์ถ๊ฐ
*/
licenseHeader '/* Licensed under Apache Corp */'
/**
* import ์์๋ ์ ์๊ฐ ๊ฐ๋ฅํ๋ค.
*/
importOrder 'java', 'javax', 'org', 'com', 'com.diffplug', ''
/**
* Google Java Format์ ์ฝ๊ฒ ์ ์ฉํ ์ ์๋ค.
*/
googleJavaFormat()
}
/**
* ํน์ ํ์ผ์ ๋ํด ์ ์ฉํ ์ ์๋ค.
*/
format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
}
Use Guide
./gradlew build
- ์ปจ๋ฒค์
์ด ์ง์ผ์ง์ง ์์ผ๋ฉด build๋ ์คํจํ๊ฒ ๋๋ค.
./gradlew spotlessApply
- ์ ํด์ง ์ปจ๋ฒค์
์ ์ ์ฉํ๋ค.
๋๋๋ ์๋ํ๋ ํ ์ ์์๊น?
Reference