Skip to content
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

fix: 레포지토리 조회 메서드가 레포지토리 링크를 받도록 수정 #750

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Sep 4, 2024

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • GithubClientgetRepository 메서드는 'owner/repo'의 형식으로 값을 받아야 하는데, repo링크가 통째로 들어가서 발생한 이슈입니다.
  • repo 링크를 받아서 getRepository 메서드 내부에서 변환하도록 수정했습니다.
  • getOwnerRepo 메서드를 GithubUtil로 분리할까도 생각해봤지만, api 호출을 위해 적절한 형식으로 변환하는 것도 GithubClient의 역할이라고 볼 수 있고, 결정적으로 사용하는 곳이 여기밖에 없어서 분리하지 않았습니다.

📝 참고사항

📚 기타

Summary by CodeRabbit

  • 새로운 기능
    • getOwnerRepo 메서드를 추가하여 전체 리포지토리 링크에서 소유자 및 리포지토리 이름을 추출하는 로직을 중앙 집중화했습니다.
    • getRepository 메서드의 매개변수를 명확하게 변경하여 리포지토리 정보를 보다 간결하게 처리합니다.
  • 버그 수정
    • API 호출 시 리포지토리 이름의 일관성을 보장하기 위해 getCommitDate 메서드를 업데이트했습니다.

@Sangwook02 Sangwook02 added the 🐛 bug/error 버그 및 에러 픽스 label Sep 4, 2024
@Sangwook02 Sangwook02 self-assigned this Sep 4, 2024
@Sangwook02 Sangwook02 requested a review from a team as a code owner September 4, 2024 10:24
Copy link

coderabbitai bot commented Sep 4, 2024

Walkthrough

변경 사항은 StudentStudyHistoryServiceGithubClient 클래스에서 주로 발생하였으며, 특히 updateRepository 메서드의 단순화와 새로운 getOwnerRepo 메서드의 도입이 포함됩니다. 이로 인해 리포지토리 링크 처리 방식이 개선되었고, 코드의 가독성과 유지 관리성이 향상되었습니다.

Changes

파일 경로 변경 요약
src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryService.java updateRepository 메서드에서 getOwnerRepo 메서드를 제거하고 그 로직을 통합함.
src/main/java/com/gdschongik/gdsc/infra/github/client/GithubClient.java getRepository 메서드의 파라미터 이름 변경 및 새로운 getOwnerRepo 메서드 추가.

Assessment against linked issues

Objective Addressed Explanation
🐛 과제 제출 시 500 에러 발생 (#749)

🐰 변화의 기쁨을 노래해요,
코드가 더 간단해졌어요!
리포지토리 링크가 명확해져,
유지 보수도 쉬워졌어요.
모두 함께 춤을 춰요,
새로운 시작을 축하해요! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Sep 4, 2024

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
src/main/java/com/gdschongik/gdsc/infra/github/client/GithubClient.java (1)

113-116: 새로운 getOwnerRepo 메서드는 코드의 가독성과 유지 관리성을 향상시킵니다.

getOwnerRepo 메서드는 전체 리포지토리 링크에서 소유자와 리포지토리 이름을 추출하는 로직을 캡슐화하여 코드의 가독성과 유지 관리성을 개선합니다.

개선 제안: 매직 넘버 대신 상수를 사용하세요.

GITHUB_DOMAIN.length()는 매직 넘버로 간주될 수 있습니다. 대신 GITHUB_DOMAIN의 길이를 나타내는 상수를 도입하는 것이 좋습니다.

+private static final int GITHUB_DOMAIN_LENGTH = GITHUB_DOMAIN.length();

private String getOwnerRepo(String repositoryLink) {
-    int startIndex = repositoryLink.indexOf(GITHUB_DOMAIN) + GITHUB_DOMAIN.length();
+    int startIndex = repositoryLink.indexOf(GITHUB_DOMAIN) + GITHUB_DOMAIN_LENGTH;
    return repositoryLink.substring(startIndex);
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e44cabc and 42a6e42.

Files selected for processing (2)
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryService.java (3 hunks)
  • src/main/java/com/gdschongik/gdsc/infra/github/client/GithubClient.java (3 hunks)
Additional comments not posted (3)
src/main/java/com/gdschongik/gdsc/infra/github/client/GithubClient.java (2)

33-35: LGTM!

getRepository 메서드의 시그니처 변경과 getOwnerRepo 메서드 호출을 통한 리팩토링은 코드의 명확성과 관심사 분리를 개선합니다.


63-64: LGTM!

getLatestAssignmentSubmission 메서드에서 getOwnerRepo 메서드를 호출하여 리포지토리 이름을 추출하는 것은 getRepository 메서드의 변경 사항과 일관되며, 입력 링크에서 리포지토리 이름을 일관되게 포맷하고 추출합니다.

src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryService.java (1)

58-58: 리포지토리 링크 처리 로직 개선

getOwnerRepo 메서드를 제거하고 request.repositoryLink()를 직접 사용하여 GHRepository 객체를 얻는 것은 코드를 간결하게 만들고 가독성과 유지 관리성을 향상시킵니다. 이는 리포지토리 링크 처리에 대한 보다 직접적인 접근 방식으로의 전환을 나타내며, 향후 수정이나 테스트 작업을 단순화할 수 있습니다.

Copy link

github-actions bot commented Sep 4, 2024

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 42a6e42 and d15e3b4.

Files selected for processing (1)
  • src/main/java/com/gdschongik/gdsc/infra/github/client/GithubClient.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/gdschongik/gdsc/infra/github/client/GithubClient.java

@Sangwook02 Sangwook02 changed the title fix: 레포지토리 조회 메서드가 적절한 값을 받도로 수정 fix: 레포지토리 조회 메서드가 레포지토리 링크를 받도록 수정 Sep 4, 2024
@Sangwook02 Sangwook02 merged commit 920825d into develop Sep 4, 2024
1 check passed
@Sangwook02 Sangwook02 deleted the fix/749-submit-assignment-server-error branch September 4, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug/error 버그 및 에러 픽스
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 과제 제출 시 500 에러 발생
1 participant