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: parse_path failed under windows #1571

Merged
merged 3 commits into from
Sep 6, 2024
Merged

fix: parse_path failed under windows #1571

merged 3 commits into from
Sep 6, 2024

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Sep 5, 2024

e.g. builld with-antd

image

Summary by CodeRabbit

  • 新功能

    • 更新了路径解析功能,以支持Windows文件路径处理,增强了跨平台兼容性。
  • 测试

    • 新增测试用例以验证Windows路径的解析功能。

Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Walkthrough

此次更改对parse_path函数进行了显著修改,以支持Windows文件路径处理。函数现在检查操作系统类型,并相应地调整路径格式,确保在Windows环境中正确解析路径和查询参数。此外,新增了测试用例以验证Windows路径的功能,增强了跨平台兼容性。

Changes

文件 更改摘要
crates/mako/src/ast/file.rs 修改parse_path函数以支持Windows路径处理,并添加新测试用例。

Poem

在草地上,我欢快跳跃,
新路径如春风轻拂,
Windows也能畅通无阻,
解析之旅更精彩,
兔子们齐声欢呼,
让我们一起庆祝这变化! 🐇✨


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
Contributor

@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 624f8fe and 708df5d.

Files selected for processing (1)
  • crates/mako/src/ast/file.rs (3 hunks)
Additional comments not posted (2)
crates/mako/src/ast/file.rs (2)

335-360: 审查 parse_path 函数的更改

此函数现在根据操作系统调整路径格式,以支持 Windows 路径。使用 Url 来解析查询字符串是一个合理的选择,可以简化代码逻辑。建议在处理路径和查询字符串之前添加更多的注释,以提高代码的可读性。


388-396: 审查 test_parse_path_support_windows 测试用例

此测试用例旨在验证 parse_path 函数对 Windows 路径的处理。测试结构良好,检查了路径、搜索、参数和片段的正确性。建议添加更多边缘情况测试,例如包含多个查询参数或特殊字符的路径。

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.00%. Comparing base (624f8fe) to head (fd8aa3c).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1571      +/-   ##
==========================================
+ Coverage   61.92%   62.00%   +0.08%     
==========================================
  Files         127      127              
  Lines       15311    15344      +33     
==========================================
+ Hits         9481     9514      +33     
  Misses       5830     5830              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// so we need to decode it, e.g. "a%20b" -> "a b"
let path = percent_decode_str(&path).decode_utf8()?;
Ok((path.to_string(), search, query_vec, fragment))
let path = if env::consts::OS == "windows" {
Copy link
Contributor

Choose a reason for hiding this comment

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

不要用运行时判断吧,用 cfg 条件编译

Copy link
Contributor

@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 708df5d and a24245f.

Files selected for processing (1)
  • crates/mako/src/ast/file.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • crates/mako/src/ast/file.rs

@stormslowly
Copy link
Member

CI 的 E2E 也加上 windows-latest 吧

@sorrycc
Copy link
Member Author

sorrycc commented Sep 6, 2024

CI 的 E2E 也加上 windows-latest 吧

should be done in seperate pr.

@sorrycc sorrycc merged commit 0903a4f into master Sep 6, 2024
17 checks passed
@sorrycc sorrycc deleted the sorrycc-1c24 branch September 6, 2024 03:29
Copy link
Contributor

@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 a24245f and fd8aa3c.

Files selected for processing (1)
  • crates/mako/src/ast/file.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • crates/mako/src/ast/file.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants