-
Notifications
You must be signed in to change notification settings - Fork 3
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
๐ ํ๋ก์ ํธ์ checkstyle(lint)๊ณผ code style(formatter) ์ค์ #19
๐ ํ๋ก์ ํธ์ checkstyle(lint)๊ณผ code style(formatter) ์ค์ #19
Conversation
checkstye.xml์ google ์คํ์ผ์ ๋ฐ๋ฅธ๋ค.
๋ถํ์ํ ๊ท์น์ ์ก์์ค๋ค๋ฉด ๋์ค์ ์ถ๊ฐ ์์
- ํ๋ฌ๊ทธ์ธ ์ถ๊ฐ - checkstyle config ํ์ผ๊ณผ ํ๋กํผํฐ, ๋ฒ์ ์ค์
This reverts commit 8c08ce5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check style ๋๋ฌธ์ธ์ง ์ฝ๋ ์ปจ๋ฒค์ ์ด ๋ค๋ฅธ ๋ถ๋ถ์ด ์๋ค์!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ณ ์ํ์
จ์ต๋๋ค!
๋ฆฌ๋ทฐ๋ก ๋จ๊ธด ๋ถ๋ถ์ ๊ฐ์ด ๊ฒํ ํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.MappedSuperclass; | ||
import lombok.Getter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด ๋ถ๋ถ์ import๋ฌธ์ ์ค๋๊ฐ ๋ค๋ฅธ ๊ฒ ๊ฐ์์!
์๋์ ๊ฐ์ด formatting์ด ๋์ผํ ๊ฒ ๊ฐ์ต๋๋ค!
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ์ธํด์ ๋ฐฉ๊ธ ๊ณ ์ณค์ต๋๋ค! ๋ฐ๋ก ์ปค๋ฐ ์ฌ๋ฆฌ๊ฒ ์ต๋๋ค!
build.gradle
Outdated
checkstyle { | ||
toolVersion = "10.12.5" | ||
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml") | ||
configProperties = [ | ||
"org.checkstyle.google.suppressionfilter.config" : "suppressions.xml", | ||
"org.checkstyle.google.suppressionxpathfilter.config": "suppressions.xml"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด ๋ถ๋ถ์ ํ์ ์๋ ๊ณต๋ฐฑ์ด ์กฐ๊ธ ์๋ค์!
์๋์ ๊ฐ์ด ์์ ํ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค
checkstyle { | |
toolVersion = "10.12.5" | |
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml") | |
configProperties = [ | |
"org.checkstyle.google.suppressionfilter.config" : "suppressions.xml", | |
"org.checkstyle.google.suppressionxpathfilter.config": "suppressions.xml"] | |
} | |
checkstyle { | |
toolVersion = "10.12.5" | |
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml") | |
configProperties = [ | |
"org.checkstyle.google.suppressionfilter.config" : "suppressions.xml", | |
"org.checkstyle.google.suppressionxpathfilter.config": "suppressions.xml"] | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ก์ ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ๋ญ๊ฐ ์ค๋ฐ๊ฟ ์์ ์ ์ข ๋ง์ด ํ๋ค๋ณด๋ ์ปดํจํฐ๊ฐ ์ ๋๋ก ์ก์ง ๋ชปํ๋ ๊ฒ ๊ฐ๋ค์,,, ์๋์ฐ์์๋ ์๋ ๊ณ ์น ๋ถ๋ถ์ฒ๋ผ ๋ณด์ฌ์ ์ธ์์ ๋ชปํ๊ณ ์์์ต๋๋ค! ๊ฐ์ฌํฉ๋๋คใ ใ ใ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์์ ์ด์ ์๋ ํญ๋ฌธ์๊ฐ ์์๋ค์! ide ์์์๋ ์คํ์ด์ค 4๊ฐ ํฌ๊ธฐ์ ๋์ผํ๊ฒ ๋ณด์ด๋๋ฐ github์์๋ ํฌ๊ธฐ๊ฐ ๋ฌ๋ผ์ ๋ค๋ฅด๊ฒ ๋ณด์ด๋ ๊ฒ์ด์์ต๋๋ค! ์คํ์ด์ค 4๊ฐ๋ก ์์ ํ์ต๋๋ค~!
๊ทธ๋ฃน ์ค์ ์์ ์๋ชป๋ ๋ถ๋ถ ์์
์์ ์ด์ ์๋ ํญ๋ฌธ์๊ฐ ์์๋ค. ์ด ๋ถ๋ถ ๋๋ฌธ์ github์ ์ฌ๋ผ๊ฐ์ ๋ ๋ค๋ฅด๊ฒ ๋ณด์ด๋ ๊ฒ ๊ฐ๋ค.
โ ์๊ตฌ์ฌํญ
๐ ์ฃผ์ ๋ณ๊ฒฝ์ฌํญ
checkstyle(Java Lint) ์ ์ฉ
config/checkstyle/checkstyle.xml
์ถ๊ฐ: ๊ธฐ๋ณธ ์คํ์ผ์ธ ๊ตฌ๊ธ google checkstyle ์ ์ฉ ํ ์ปค์คํ config/checkstyle/suppressions.xml
์ถ๊ฐ: Lint๋ฅผ ์กฐ๊ธ ๋ ์ธ๋ฐํ๊ฒ ๋ฐ์ํ๊ณ ์ถ์ง ์์ ๋. ๋ถํ์ํ Lint Warning์ด ์์ ๋ ์ฝ๋๋ฅผ ์์ฑํ๋ ํ์ผ(checkstyle.xml
ํ์ผ๊ณผ ์ธํธ์ ๋๋น.)config/checkstyle/configuration_1_3.dtd
๊ณผconfig/checkstyle/suppressions_1_2.dtd
: ์๋ ์ด ํ์ผ์ ์๋ณธ ๊ตฌ๊ธcheckstyle.xml
,suppressions.xml
์์ http๋ก ๋งค๋ฒ ๋ฐ์์์ผํ๋ ๊ฒ ๊ฐ๋๋ฐ http ํต์ ์์ด ์ฌ์ฉํ ์ ์๋๋ก ์์ ๋ฃ์ด๋จ์ต๋๋ค.gradle.build
์ ํ๋ฌ๊ทธ์ธ ์ ์ฉ ๋ฐ ์ ์ค์ ํ์ผ๋ค ์ธ์ํ๋๋ก ์ค์ checkstyle์ ๊ธฐ๋ฐ์ผ๋ก ํ code style ์์ฑ
ProjectCodeStyleConfiguration.xml
๊ณผ intellij code style xml(.idea/codeStyles/Project.xml
) ์ถ๊ฐ| ์ธ๋ถ ์คํ์ผ ์ค์ ์ commit log ์ฐธ๊ณ ๋ถํ๋๋ฆฝ๋๋ค!
๐ก ๊ธฐํ์ฌํญ
๐จ pull ์ดํ code style ์ค์ ๋ฐ์์ด ์๋๋ค๋ฉด ์๋ ์ด๋ฏธ์ง์ฒ๋ผ
Project
๋ฅผ ์ค์ ํด์ค์ผํฉ๋๋ค!(์๋ ์ฌ์ง ์ฐธ๊ณ )1. Code Style ์ค์ ๋ฐฉ๋ฒ์ ๋ํ ๊ณ ๋ฏผ์ ํ์ต๋๋ค.
2. ์ถํ ์๊ฐํ ์ผ(์ฐธ๊ณ )
gradle.build
ํ์ผ์์ checkstyle ์ค์ ์์ maxWarnings ์ฒ๋ฆฌ๋ฅผ ์ํ ์ํ๋ผ ๊ฒฝ๊ณ ๋ง ๋จ๊ณ ๋น๋์๋ ์ํฅ์ด ๊ฐ์ง ์์ต๋๋ค. ์ถํ ํ์ํ๋ค๋ฉด ๋น๋์๋ ์ํฅ์ด ๊ฐ๋๋ก ๋ฐ๊พธ๊ฒ ์ต๋๋ค!3. TMI(2023.12.22 ์ ์ )
์๋ชป๋ ์ค๋ช
: _checkstyle์ java code style๋ง ํ์ธํ๋ ๊ฒ ๊ฐ์ต๋๋ค! ์๊น ๋ค๊ฐ์ด ๋ณธfileExtensions
์ ์ฌ๊ธฐ ์ค๋ช ์ ๋ฐ๋ฅด๋ฉด ํ์ฉ๋๋ ํ์ผ ํ์ฅ์๋ช ์ด๋ผ๊ณ ๋ง ๋์ด์๋ค์..! ๋ ๊ณต์๋ฌธ์์์๋ java code ์์ฃผ๋ก๋ง ๋ณธ๋ค๋ ๋ง๋ ์์ด์!