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

build(deps): remove unused dependencies #631

Merged
merged 6 commits into from
Nov 27, 2024
Merged

Conversation

tedil
Copy link
Contributor

@tedil tedil commented Nov 25, 2024

Summary by CodeRabbit

  • Chores
    • Updated the dhat-heap feature to depend on the dhat package.
    • Moved the dhat dependency to an optional section, enhancing dependency management.
    • Updated tokio dependency features for improved functionality.
    • Enhanced caching mechanism in the CI pipeline for faster builds.
    • Updated repository checkout process in the CI pipeline to support Git Large File Storage.

Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

Walkthrough

The Cargo.toml file for the mehari package has been modified to update the dependency management structure. The dhat-heap feature now depends on the dhat package, which has been moved to an optional dependencies section with a specified version. The tokio dependency has also been updated to include specific features. The overall structure of the dependencies remains largely unchanged, and comments within the file have been preserved. Additionally, the GitHub Actions CI workflow has been updated to enhance caching for Rust dependencies and support for Git Large File Storage in the linting job.

Changes

File Change Summary
Cargo.toml Updated dhat-heap feature to depend on dhat. Moved dhat to optional dependencies with version 0.3.3. Updated tokio features from ["full"] to ["rt-multi-thread", "macros"].
.github/workflows/rust.yml Enhanced caching mechanism in the Testing job and updated checkout process in the Linting job for Git LFS support.

Possibly related PRs

Suggested reviewers

  • holtgrewe

Poem

In the meadow where we play,
Changes come in a grand array.
Dependencies shift, oh what a sight,
Optional now, they take flight!
With dhat-heap leading the way,
We hop along, hip-hip-hooray! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c1eef27 and 57524bd.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .github/workflows/rust.yml (1 hunks)
  • Cargo.toml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/rust.yml
  • Cargo.toml

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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

🧹 Outside diff range and nitpick comments (1)
Cargo.toml (1)

Based on the analysis of the dependencies and their usage in the codebase, I can now provide a final response:

Several dependencies appear to be unused or only used in tests

The following dependencies in Cargo.toml appear to be unused in the main codebase:

  • async-std - No usage found in the codebase
  • criterion - No usage found (likely only used for benchmarking)
  • percent-encoding - No usage found in the codebase
  • tracing-subscriber - No direct usage found despite being a dependency
  • tracing-test - Only used in tests (should be in dev-dependencies)

Consider:

  1. Moving tracing-test to [dev-dependencies] section
  2. Removing unused dependencies: async-std, criterion, percent-encoding
  3. Evaluating if tracing-subscriber is truly needed or if it's an indirect dependency
🔗 Analysis chain

Line range hint 1-128: PR objective mismatch: No dependencies were removed

The PR title "build(deps): remove unused dependencies" suggests that unused dependencies would be removed. However, the changes only reorganize the dhat dependency without removing any dependencies. This appears to be a mismatch between the PR objective and the actual changes.

Consider either:

  1. Updating the PR title to reflect the actual changes (e.g., "build(deps): make dhat dependency optional")
  2. Or identifying and removing truly unused dependencies if that was the original intention

Let's verify if there are any unused dependencies that could be removed:


Let's gather more information to verify if there are any unused dependencies by comparing the dependencies listed in Cargo.toml with their actual usage in the code.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potentially unused dependencies using cargo-udeps
# Note: This is just a suggestion as cargo-udeps would need to be run locally

# First, let's check which dependencies are actually imported in the code
rg --type rust "^use\s+(\w+)(::|\s+as\s+)" -g '!target/**' --no-filename | sort -u

# Also check for direct references to crate names
rg --type rust "extern\s+crate\s+(\w+)" -g '!target/**' --no-filename | sort -u

Length of output: 7696


Script:

#!/bin/bash
# Get all dependency names from Cargo.toml
echo "=== Dependencies from Cargo.toml ==="
rg '^\w+ = .*$' Cargo.toml | grep -v '\[' | cut -d' ' -f1 | sort -u

# Check for actual usage patterns for potentially unused dependencies
echo -e "\n=== Usage Patterns ==="
for dep in "async-std" "csv" "criterion" "dhat" "env_logger" "hxdmp" "insta" "jsonl" "pbjson" "percent-encoding" "procfs" "tempfile" "thousands" "tracing-subscriber" "tracing" "tracing-test" "zstd"; do
    echo "Checking $dep:"
    rg --type rust -i "\b${dep}[:\s]" --stats
    echo "---"
done

Length of output: 26049

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a5d7bdb and 629110d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • Cargo.toml (2 hunks)
🔇 Additional comments (2)
Cargo.toml (2)

14-14: LGTM: Feature flag correctly configured

The dhat-heap feature is now properly configured to depend on the optional dhat dependency using the dep: prefix.


82-85: LGTM: Dependency correctly moved to optional section

The dhat dependency has been appropriately moved to an optional dependency section, which is the correct way to handle feature-gated dependencies in Rust.

@tedil tedil enabled auto-merge (squash) November 25, 2024 14:54
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: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/rust.yml (1)

107-111: LGTM! Consider expanding cache coverage.

The cache configuration for RocksDB system bindings is well-placed before the build step and will help improve build times.

Consider caching additional directories for other system dependencies:

       with:
         cache-directories: |
           ~/.cargo/registry/src/**/librocksdb-sys-*
+          ~/.cargo/registry/src/**/libsnappy-sys-*
+          ~/.cargo/registry/src/**/libsqlite3-sys-*
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 99b60a2 and c1eef27.

📒 Files selected for processing (1)
  • .github/workflows/rust.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/rust.yml

119-119: property "release-please" is not defined in object type {formatting: {outputs: {}; result: string}}

(expression)

🔇 Additional comments (1)
.github/workflows/rust.yml (1)

Line range hint 1-1: Verify alignment with PR objectives.

The PR's objective is to "remove unused dependencies", but this workflow file mainly contains changes related to caching and LFS support. Please clarify if these changes are related to dependency removal or if they should be in a separate PR.

🧰 Tools
🪛 actionlint (1.7.4)

119-119: property "release-please" is not defined in object type {formatting: {outputs: {}; result: string}}

(expression)

Comment on lines 119 to 123
if: ${{ needs.release-please.outputs.release_created }}
with:
key: "covtest"
cache-directories: |
~/.cargo/registry/src/**/librocksdb-sys-*

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix undefined job dependency.

The cache step depends on needs.release-please but this job is not defined in the workflow. This will cause the condition to fail.

Either:

  1. Remove this duplicate cache step since it's redundant with the previous one, or
  2. Add the missing job dependency:
jobs:
+ release-please:
+   runs-on: ubuntu-24.04
+   outputs:
+     release_created: ${{ steps.release.outputs.release_created }}
+   steps:
+     - uses: google-github-actions/release-please-action@v3
+       id: release
  Testing:
-   needs: Formatting
+   needs: [Formatting, release-please]
    runs-on: ubuntu-24.04

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint (1.7.4)

119-119: property "release-please" is not defined in object type {formatting: {outputs: {}; result: string}}

(expression)

@tedil tedil merged commit a8a923f into main Nov 27, 2024
9 checks passed
@tedil tedil deleted the remove-unused-dependencies branch November 27, 2024 14:31
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