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

feat: 깃허브 레포지토리 정규표현식 추가 #743

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Sep 3, 2024

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • 깃허브 레포지토리 수정 dto에서 링크 패턴 지정했습니다.
  • 깃허브의 정책
    • 유저네임은 알파벳과 숫자를 사용할 수 있고, 문자열 사이에서 최대 한번 하이픈을 사용할 수 있습니다.
    • 레포지토리 이름은 ASCII letters, digits, and the characters . - _ 를 사용할 수 있습니다.

📌 작업 내용 및 특이사항

  • 깃허브 레포지토리 수정 dto에서 링크 패턴 지정했습니다.

📝 참고사항

📚 기타

Summary by CodeRabbit

  • 새로운 기능
    • GitHub 저장소 링크에 대한 유효성 검사를 강화하여 올바른 형식을 보장합니다.
  • 버그 수정
    • repositoryLink 필드에 대한 추가 유효성 검사 로직을 도입하여 데이터 무결성을 향상시킵니다.

@Sangwook02 Sangwook02 added the ✨ feature 새로운 기능 추가 및 수정 label Sep 3, 2024
@Sangwook02 Sangwook02 self-assigned this Sep 3, 2024
@Sangwook02 Sangwook02 requested a review from a team as a code owner September 3, 2024 02:17
Copy link

coderabbitai bot commented Sep 3, 2024

Walkthrough

변경 사항은 RepositoryUpdateRequest 클래스의 repositoryLink 필드에 대한 유효성 검사 로직을 강화하는 것입니다. @NotBlank 주석 외에, 새로운 @Pattern 주석이 추가되어 repositoryLink가 특정 정규 표현식 RegexConstant.GITHUB_REPOSITORY와 일치해야 함을 보장합니다. 이로 인해 GitHub 저장소 URL의 형식이 검증됩니다.

Changes

파일 경로 변경 요약
src/main/java/com/gdschongik/gdsc/domain/study/dto/request/RepositoryUpdateRequest.java repositoryLink 필드에 @Pattern 주석 추가, GitHub 저장소 URL 형식 검증.
src/main/java/com/gdschongik/gdsc/global/common/constant/RegexConstant.java GITHUB_REPOSITORY 상수 추가, GitHub 저장소 URL 검증을 위한 정규 표현식 정의.

Assessment against linked issues

Objective Addressed Explanation
레포지토리 입력 패턴 지정 (#738)

Poem

🐰
저장소 링크가 반짝이네,
정규 표현식으로 맞춰지네.
빈칸은 없고, 형식도 맞아,
이제 모두가 안심하고 사용해!
귀여운 코드, 기분 좋아!
🐇✨


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.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

Copy link

github-actions bot commented Sep 3, 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/global/common/constant/RegexConstant.java (1)

15-16: GitHub 저장소 정규표현식이 잘 구현되었습니다.

정규표현식이 GitHub의 사용자 이름과 저장소 이름 규칙을 잘 반영하고 있습니다. PR의 목적을 충족시키는 좋은 구현입니다.

가독성을 위해 정규표현식을 여러 줄로 나누는 것을 고려해 보세요. 다음과 같이 수정할 수 있습니다:

-    public static final String GITHUB_REPOSITORY =
-            "^https:\\/\\/github\\.com\\/[A-Za-z0-9]+(-[A-Za-z0-9]+)*\\/[A-Za-z0-9._-]+$";
+    public static final String GITHUB_REPOSITORY =
+            "^https://github\\.com/" +
+            "[A-Za-z0-9]+(-[A-Za-z0-9]+)*/" +  // 사용자 이름
+            "[A-Za-z0-9._-]+$";  // 저장소 이름

이렇게 하면 각 부분이 무엇을 의미하는지 더 명확해집니다.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 171694c and eda8780.

Files selected for processing (2)
  • src/main/java/com/gdschongik/gdsc/domain/study/dto/request/RepositoryUpdateRequest.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/global/common/constant/RegexConstant.java (1 hunks)
Additional comments not posted (2)
src/main/java/com/gdschongik/gdsc/domain/study/dto/request/RepositoryUpdateRequest.java (2)

3-5: 새로운 import 문 추가 확인

RegexConstantPattern 클래스를 import하는 새로운 문장이 추가되었습니다. 이는 GitHub 저장소 링크의 유효성 검사를 위한 정규 표현식 패턴을 사용하기 위한 준비 단계입니다.


7-8: GitHub 저장소 링크 유효성 검사 강화

RepositoryUpdateRequest 레코드의 repositoryLink 필드에 @Pattern 어노테이션이 추가되었습니다. 이는 PR의 목적에 부합하며, GitHub 저장소 링크의 형식을 검증하는 데 도움이 될 것입니다.

RegexConstant.GITHUB_REPOSITORY의 구현을 확인하기 위해 다음 스크립트를 실행해 주세요:

이 스크립트의 결과를 통해 정규 표현식 패턴이 PR 목적에 맞게 올바르게 구현되었는지 확인할 수 있습니다.

Verification successful

GitHub 저장소 링크 유효성 검사 확인 완료

RegexConstant.GITHUB_REPOSITORY의 정규 표현식 패턴이 GitHub 저장소 링크를 올바르게 검증하도록 구현되었습니다. 이 패턴은 https://github.com/으로 시작하고, 유효한 사용자명 및 저장소명을 포함하도록 설계되었습니다. PR의 목적에 부합합니다.

  • RegexConstant.java에서 GITHUB_REPOSITORY 상수의 정의가 확인되었습니다.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# RegexConstant.GITHUB_REPOSITORY 구현 확인

# RegexConstant 클래스 찾기
fd -e java -x grep -H 'class RegexConstant' {}

# GITHUB_REPOSITORY 상수 정의 찾기
fd -e java -x grep -H 'GITHUB_REPOSITORY' {}

Length of output: 804


Script:

#!/bin/bash
# Extract the full definition of the GITHUB_REPOSITORY constant from RegexConstant.java

# Locate the RegexConstant.java file and extract the GITHUB_REPOSITORY constant definition
fd -e java -x grep -A 3 'GITHUB_REPOSITORY' {}

Length of output: 763

Copy link
Member

@uwoobeat uwoobeat left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@seulgi99 seulgi99 left a comment

Choose a reason for hiding this comment

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

LGTM

@Sangwook02 Sangwook02 merged commit 8318213 into develop Sep 3, 2024
1 check passed
@Sangwook02 Sangwook02 deleted the feature/738-repository-pattern branch September 3, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 새로운 기능 추가 및 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ 레포지토리 입력 패턴 지정
3 participants