-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: 코드 정적 분석을 위한 Jacoco 및 SonarCloud 도입 #147
Conversation
처음 커버리지 측정한 거라 모든 코드에 대해 측정이 됐나보네요. 👀 |
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.
궁금한 점들 남겨놨어요~
천천히 머지해도 된다면 베어 리뷰도 받은 후에 머지하면 좋을 거 같습니다
여담으로, 소나 code smell 개선 jira 티켓을 백로그로 만들어두어도 괜찮겠네요!
"**/*Application*", | ||
"**/*Controller*", | ||
"**/config/*", | ||
"**/dto/*", | ||
"**/exception/*", | ||
"**/security/*", | ||
"**/support/*" |
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.
테스트 커비리지 제외하는 패키지로 이해했는데 맞을까요?
Controller
, dto
, exception
, support
까지 제외한 이유가 궁금합니다~
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.
dto는 비즈니스로직만 테스트하여도 커버리지가 좀 나왔던 것 같은데, dto도 제외시키는게 좋을까요?
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.
excludes = [ | ||
'**.*Application*', | ||
'**.*Controller*', | ||
'**.config.*', | ||
'**.dto.*', | ||
'**.exception.*', | ||
'**.security.*', | ||
'**.support.*' | ||
] + Qdomains |
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.
위에 남긴 코멘트 내용과 동일합니다~ 참고로 해당 태스크는 커버리지를 확인하는 태스크입니다.
with: | ||
arguments: check | ||
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} |
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.
cache-read-only
는 빌드 시에 gradle cache를 이용해서 하도록 적용하는 것으로 이해했는데 맞을까요?
아래 이유가 궁금해서 코멘트 작성해봅니다 😄
- 캐시 도입 이유
- main, develop 브랜치에는 캐시 적용 제외된 이유
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.
이 부분은 main과 develop 브랜치일때만 cache-read-only
가 false되게 설정한 부분입니다. cache-read-only
는 true일 경우 cache를 읽기만 하고 cache에 저장하지 않고 false일 경우는 읽기와 저장 모두 수행합니다.
결국 main이나 develop 브랜치에서 푸시될 때만 캐시에 저장되고 다른 브랜치들에서는 캐시읽기만 허용한 것인데 주로 안정된 코드를 추가하는 주요 브랜치에서만 빌드 시간을 최적화하기 위해 이렇게 설정했습니다.
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.
오..이부분 read-only가 true일 때랑 false일 때랑 시간의 차이도 궁금하네요 👀 새로운 것을 알아갑니다 👍
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.
소나 클라우드 아는게 거의 없어서 질문 밖에 없는 것 같네요 😢
질문만 확인해주시고, Jacoco와 SonarCloud는 사용하면서 개선해가도 좋을 것 같아요. 😄
고생하셨습니다 🙏
with: | ||
arguments: check | ||
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} |
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.
오..이부분 read-only가 true일 때랑 false일 때랑 시간의 차이도 궁금하네요 👀 새로운 것을 알아갑니다 👍
- name: Build and analyze | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
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.
SONAR_TOKEN
도 추가되었군요 👀
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.
네 맞아요. SonarCloud에 대한 액세스를 인증하는데 사용되는 토큰입니다~
"**/*Application*", | ||
"**/*Controller*", | ||
"**/config/*", | ||
"**/dto/*", | ||
"**/exception/*", | ||
"**/security/*", | ||
"**/support/*" |
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.
dto는 비즈니스로직만 테스트하여도 커버리지가 좀 나왔던 것 같은데, dto도 제외시키는게 좋을까요?
build.gradle
Outdated
sonar { | ||
properties { | ||
property 'sonar.host.url', 'https://sonarcloud.io' | ||
property 'sonar.organization', 'mocacong' | ||
property 'sonar.projectKey', 'mocacong_Mocacong-Backend' | ||
property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/jacoco/index.xml' | ||
property 'sonar.sources', 'src' | ||
property 'sonar.language', 'java' | ||
property 'sonar.sourceEncoding', 'UTF-8' | ||
property 'sonar.exclusions', '**/test/**, **/resources/**, **/*Application*.java, **/*Controller*.java ,**/config/**, **/dto/**, ' + | ||
'**/exception/**, **/security/**, **/support/**, **/Q*.java' | ||
property 'sonar.test.inclusions', '**/*Test.java' | ||
property 'sonar.java.coveragePlugin', 'jacoco' | ||
} | ||
} |
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.
개인적으로는 jacoco 관련 설정이 아래로 가고 의존성 선언이 더 위쪽으로 왔으면 하는데 어떤가요?
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.
좋습니다. 안그래도 새로 생긴 태스크들 추가하면서 dependency 위치를 어디다 두어야 할지가 고민됐었네요 ㅎㅎ..
Quality Gate failedFailed conditions 1 Security Hotspot See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
개요
작업사항
주의사항