Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Pull Request Overview
This PR enhances request parameter validation by introducing a RepositoryURL type and updates associated handlers, plus it adds tests to verify URL deserialization logic.
- Switched from raw
StringURLs to aRepositoryURLstruct with built-in validation. - Implemented custom
DeserializeforRepositoryURLand itsvalidatemethod. - Added unit tests for valid/invalid GitHub URLs and updated link validation tests.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rook/src/main.rs | Replaced repo_url: String with RepositoryURL, implemented deserialization and validation. |
| rook/src/main_test.rs | Added comprehensive tests for RepositoryURL deserialization covering valid and invalid cases. |
| rook/src/link/mod.rs | Updated existing link test input from .com to .ai and maintained invalid-check test. |
Comments suppressed due to low confidence (1)
rook/src/link/mod.rs:42
- Consider adding a complementary test case for a valid link scenario to ensure
check_linkcorrectly accepts valid URLs.
let link = "https://redddy.ai";
rook/src/main.rs
Outdated
| if !self.url.starts_with("https://github.com/") { | ||
| return Err("URL must start with https://github.com/".to_string()); | ||
| } | ||
| let parts: Vec<&str> = self | ||
| .url | ||
| .trim_start_matches("https://github.com/") |
There was a problem hiding this comment.
Consider extracting the GitHub URL prefix "https://github.com/" into a constant to avoid magic strings and improve maintainability.
| if !self.url.starts_with("https://github.com/") { | |
| return Err("URL must start with https://github.com/".to_string()); | |
| } | |
| let parts: Vec<&str> = self | |
| .url | |
| .trim_start_matches("https://github.com/") | |
| if !self.url.starts_with(GITHUB_URL_PREFIX) { | |
| return Err(format!("URL must start with {}", GITHUB_URL_PREFIX)); | |
| } | |
| let parts: Vec<&str> = self | |
| .url | |
| .trim_start_matches(GITHUB_URL_PREFIX) |
|
아 버셀 너무 어려운데 ㅠ 왜 여서 돌아감,, |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
?? Blunder 😵💫 ❌ Failure DetailsSee the full battle logs here: View Logs Time to rethink your next move! |
There was a problem hiding this comment.
Pull Request Overview
This PR adds URL validation for GitHub repository links by introducing a RepositoryURL struct with custom deserialization logic and accompanying tests. Key changes include:
- Changing request parameters from a plain URL string to a validated RepositoryURL object.
- Updating the check and cancel handlers to use the new RepositoryURL.
- Adding tests to ensure proper URL validation.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rook/src/main_test.rs | New tests added to verify repository URL deserialization and validation. |
| rook/src/main.rs | Updated request types and handler functions to use RepositoryURL with validation logic. |
| rook/src/link/mod.rs | Updated test data for link validation. |
♟️ What’s this PR about?
github repository struct를 정의하여 요청 파라미터의 검증 로직을 추가하였고 테스트도 추가하였습니다.
🔗 Related Issues / PRs
part of #54