diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c847e4068..95f197770 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -@GDSC-Hongik/backend-dev +* @GDSC-Hongik/backend-dev diff --git "a/.github/ISSUE_TEMPLATE/\342\231\273\357\270\217-refactor.md" "b/.github/ISSUE_TEMPLATE/\342\231\273\357\270\217-refactor.md" index e162a0bec..88bc4565e 100644 --- "a/.github/ISSUE_TEMPLATE/\342\231\273\357\270\217-refactor.md" +++ "b/.github/ISSUE_TEMPLATE/\342\231\273\357\270\217-refactor.md" @@ -8,4 +8,4 @@ assignees: '' --- ## πŸ“Œ Description -- +- diff --git "a/.github/ISSUE_TEMPLATE/\342\232\231\357\270\217-chore.md" "b/.github/ISSUE_TEMPLATE/\342\232\231\357\270\217-chore.md" index cb9dcf837..ae4a239a4 100644 --- "a/.github/ISSUE_TEMPLATE/\342\232\231\357\270\217-chore.md" +++ "b/.github/ISSUE_TEMPLATE/\342\232\231\357\270\217-chore.md" @@ -8,4 +8,4 @@ assignees: '' --- ## πŸ“Œ Description -- +- diff --git "a/.github/ISSUE_TEMPLATE/\342\234\205-test.md" "b/.github/ISSUE_TEMPLATE/\342\234\205-test.md" index d2574fca4..8227bee86 100644 --- "a/.github/ISSUE_TEMPLATE/\342\234\205-test.md" +++ "b/.github/ISSUE_TEMPLATE/\342\234\205-test.md" @@ -8,4 +8,4 @@ assignees: '' --- ## πŸ“Œ Description -- +- diff --git "a/.github/ISSUE_TEMPLATE/\342\234\250-feature.md" "b/.github/ISSUE_TEMPLATE/\342\234\250-feature.md" index 08842a612..23b437e9e 100644 --- "a/.github/ISSUE_TEMPLATE/\342\234\250-feature.md" +++ "b/.github/ISSUE_TEMPLATE/\342\234\250-feature.md" @@ -8,4 +8,4 @@ assignees: '' --- ## πŸ“Œ Description -- +- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 68f377c47..187a45fde 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,10 +2,10 @@ - close # ## πŸ“Œ μž‘μ—… λ‚΄μš© 및 νŠΉμ΄μ‚¬ν•­ -- +- ## πŸ“ 참고사항 -- +- ## πŸ“š 기타 -- +- diff --git a/.github/workflows/pull_request_gradle_build.yml b/.github/workflows/pull_request_gradle_build.yml index db5b331d0..1dda5e788 100644 --- a/.github/workflows/pull_request_gradle_build.yml +++ b/.github/workflows/pull_request_gradle_build.yml @@ -20,7 +20,7 @@ jobs: - name: gradlew κΆŒν•œ λΆ€μ—¬ run: chmod +x ./gradlew - + - name: Gradle Build uses: gradle/gradle-build-action@v2 with: diff --git a/build.gradle b/build.gradle index c76ec6058..5a7430182 100644 --- a/build.gradle +++ b/build.gradle @@ -1,52 +1,79 @@ plugins { - id 'java' - id 'org.springframework.boot' version '3.2.1' - id 'io.spring.dependency-management' version '1.1.4' - id 'org.asciidoctor.jvm.convert' version '3.3.2' + id 'java' + id 'org.springframework.boot' version '3.2.1' + id 'io.spring.dependency-management' version '1.1.4' + id 'org.asciidoctor.jvm.convert' version '3.3.2' + id 'com.diffplug.spotless' version '6.23.3' } group = 'com.gdschongik' version = '0.0.1-SNAPSHOT' java { - sourceCompatibility = '17' + sourceCompatibility = '17' } configurations { - compileOnly { - extendsFrom annotationProcessor - } + compileOnly { + extendsFrom annotationProcessor + } } repositories { - mavenCentral() + mavenCentral() } ext { - set('snippetsDir', file("build/generated-snippets")) + set('snippetsDir', file("build/generated-snippets")) } dependencies { - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation 'org.springframework.boot:spring-boot-starter-web' - compileOnly 'org.projectlombok:lombok' - runtimeOnly 'com.h2database:h2' - runtimeOnly 'com.mysql:mysql-connector-j' - annotationProcessor 'org.projectlombok:lombok' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' - testImplementation 'org.springframework.security:spring-security-test' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'org.springframework.boot:spring-boot-starter-web' + compileOnly 'org.projectlombok:lombok' + runtimeOnly 'com.h2database:h2' + runtimeOnly 'com.mysql:mysql-connector-j' + annotationProcessor 'org.projectlombok:lombok' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc' + testImplementation 'org.springframework.security:spring-security-test' } tasks.named('test') { - outputs.dir snippetsDir - useJUnitPlatform() + outputs.dir snippetsDir + useJUnitPlatform() } tasks.named('asciidoctor') { - inputs.dir snippetsDir - dependsOn test + inputs.dir snippetsDir + dependsOn test +} + +jar { + enabled = false +} + +spotless { + format 'misc', { + target '**/*.yml', '**/*.gradle', '**/*.md' + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + + java { + removeUnusedImports() + palantirJavaFormat() + formatAnnotations() + } +} + +tasks.register('updateGitHooks', Copy) { + from './scripts/pre-commit' + into '.git/hooks' + + compileJava.dependsOn(this) } diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100644 index 000000000..3783ed295 --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,14 @@ +# λ³€κ²½λœ νŒŒμΌλ“€ μ΄λ¦„λ§Œ μΆ”μΆœν•˜μ—¬ μ €μž₯ +stagedFiles=$(git diff --staged --name-only) + +# SpotlessApply μ‹€ν–‰ +echo "Running spotlessApply. Formatting code..." +./gradlew spotlessApply + +# 변경사항이 λ°œμƒν•œ νŒŒμΌλ“€ λ‹€μ‹œ git add +for file in $stagedFiles; do + if test -f "$file"; then + git add "$file" + fi +done + diff --git a/src/main/java/com/gdschongik/gdsc/GdscApplication.java b/src/main/java/com/gdschongik/gdsc/GdscApplication.java index 02f7de3a0..be1268410 100644 --- a/src/main/java/com/gdschongik/gdsc/GdscApplication.java +++ b/src/main/java/com/gdschongik/gdsc/GdscApplication.java @@ -6,7 +6,7 @@ @SpringBootApplication public class GdscApplication { - public static void main(String[] args) { - SpringApplication.run(GdscApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(GdscApplication.class, args); + } } diff --git a/src/test/java/com/gdschongik/gdsc/GdscApplicationTests.java b/src/test/java/com/gdschongik/gdsc/GdscApplicationTests.java index da37566af..1e73666e7 100644 --- a/src/test/java/com/gdschongik/gdsc/GdscApplicationTests.java +++ b/src/test/java/com/gdschongik/gdsc/GdscApplicationTests.java @@ -6,8 +6,6 @@ @SpringBootTest class GdscApplicationTests { - @Test - void contextLoads() { - } - + @Test + void contextLoads() {} }