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

Escape paths #32

Merged
merged 11 commits into from
Jan 22, 2024
Merged

Escape paths #32

merged 11 commits into from
Jan 22, 2024

Conversation

alessio
Copy link
Owner

@alessio alessio commented Jan 22, 2024

Summary by CodeRabbit

  • New Features

    • Integrated a new directory management tool for better handling of path lists.
  • Refactor

    • Enhanced the directory list handling to improve performance and reliability.
  • Tests

    • Added comprehensive tests to ensure the reliability of directory list operations.
  • Documentation

    • Updated internal documentation to reflect changes in directory list management.

Copy link
Contributor

coderabbitai bot commented Jan 22, 2024

Warning

Rate Limit Exceeded

@alessio has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 18 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 700cab8 and 2275323.

Walkthrough

The recent update involves integrating a new dirlist package for managing directory paths, replacing the previous pathlist.List with dirlist.List. The dirlist package introduces methods for manipulating path lists, including adding, removing, and checking paths, as well as loading them from strings or environment variables. It also uses shellescape for path sanitization. Comprehensive tests have been added to ensure the functionality of the new package.

Changes

Files Change Summaries
cmd/pathctl/main.go Replaced pathlist.List with dirlist.List, added dirlist package import.
dirlist/dirlist.go Added new dirlist package for directory path management.
dirlist/.../list.go Updated to use shellescape for path quoting, refactored methods, and improved handling of empty strings.
dirlist/.../list_internal_test.go Added tests for internal functions of dirlist package.
dirlist/.../list_test.go Added test cases for public methods in dirlist package.

Poem

In the burrow of code, the rabbit hopped,
Paths in lists, neatly swapped.
🥕 Clean and sorted, duplicates dropped,
Celebrate the update, with a carrot topped!

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 24

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0661130 and faaadb9.
Files ignored due to path filters (2)
  • go.mod is excluded by: !**/*.mod
  • go.sum is excluded by: !**/*.sum
Files selected for processing (6)
  • cmd/pathctl/main.go (5 hunks)
  • dirlist/dirlist.go (1 hunks)
  • dirlist/dirlist_test.go (1 hunks)
  • dirlist/list.go (9 hunks)
  • dirlist/list_internal_test.go (1 hunks)
  • dirlist/list_test.go (1 hunks)
Additional comments: 4
dirlist/dirlist.go (1)
  • 13-14: The Contains function uses quoteAndClean which is not defined in this file. This could lead to issues if the function is not implemented correctly elsewhere.

Verify that quoteAndClean is implemented correctly and is accessible within this package.

dirlist/list_internal_test.go (1)
  • 26-34: The Test_removeDups function tests the removeDups function, which is not visible in this file. It assumes the function's behavior without testing it directly.

Ensure that removeDups is tested in its own context and that the test here accurately reflects its behavior.

cmd/pathctl/main.go (1)
  • 10-10: The import of the dirlist package is added, but there is no context for the removal of the previous package.

Confirm that the previous package is no longer needed and that all references to it have been updated to use dirlist.

dirlist/list.go (1)
  • 66-66: The Contains method uses quoteAndClean, which is not defined in this file.

Verify that quoteAndClean is implemented correctly and is accessible within this package.

dirlist/dirlist.go Outdated Show resolved Hide resolved
dirlist/dirlist.go Outdated Show resolved Hide resolved
dirlist/dirlist.go Outdated Show resolved Hide resolved
dirlist/dirlist.go Outdated Show resolved Hide resolved
dirlist/list_internal_test.go Outdated Show resolved Hide resolved
dirlist/list.go Outdated Show resolved Hide resolved
dirlist/list.go Outdated Show resolved Hide resolved
dirlist/list.go Outdated Show resolved Hide resolved
dirlist/list.go Show resolved Hide resolved
dirlist/list.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (0661130) 73.81% compared to head (2275323) 79.66%.

Files Patch % Lines
dirlist/list.go 87.50% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
+ Coverage   73.81%   79.66%   +5.84%     
==========================================
  Files           4        4              
  Lines         233      236       +3     
==========================================
+ Hits          172      188      +16     
+ Misses         40       31       -9     
+ Partials       21       17       -4     

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

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between faaadb9 and 57af391.
Files selected for processing (3)
  • dirlist/dirlist.go (1 hunks)
  • dirlist/list.go (10 hunks)
  • dirlist/list_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • dirlist/dirlist.go
  • dirlist/list_test.go
Additional comments: 4
dirlist/list.go (4)
  • 24-24: The Nil method is still commented out.
  • 84-94: The Slice method still contains a panic for error handling, which is not ideal.
  • 180-190: The removeDups function now uses filepath.Join on the split parts of the path, which is a change from the previous use of shellescape.Quote. This change seems to address the previous concern about quoting being unnecessary for some use cases.
  • 201-213: The filterEmptyStrings function has been refactored, and the commented-out code has been removed. This change makes the function's intent clearer and removes unnecessary code.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 57af391 and 700cab8.
Files selected for processing (4)
  • cmd/pathctl/main.go (4 hunks)
  • dirlist/list.go (10 hunks)
  • dirlist/list_internal_test.go (1 hunks)
  • dirlist/list_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • cmd/pathctl/main.go
  • dirlist/list.go
  • dirlist/list_internal_test.go
  • dirlist/list_test.go

@alessio alessio merged commit 7317496 into main Jan 22, 2024
6 checks passed
@alessio alessio deleted the pathctl-esape-paths branch January 22, 2024 11:20
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.

1 participant