Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add config for dbt deps #1565

Merged
merged 1 commit into from
Jan 27, 2025
Merged

Add config for dbt deps #1565

merged 1 commit into from
Jan 27, 2025

Conversation

mdesmet
Copy link
Contributor

@mdesmet mdesmet commented Jan 27, 2025

Overview

Problem

Describe the problem you are solving. Mention the ticket/issue if applicable.

Solution

Describe the implemented solution. Add external references if needed.

Screenshot/Demo

A picture is worth a thousand words. Please highlight the changes if applicable.

How to test

  • Steps to be followed to verify the solution or code changes
  • Mention if there is any settings configuration added/changed/deleted

Checklist

  • I have run this code and it appears to resolve the stated issue
  • README.md updated and added information about my change

Important

Adds configuration to automatically install dbt dependencies on project initialization, with default enabled, in DBTProject class.

  • Behavior:
    • Adds dbt.installDepsOnProjectInitialization configuration in package.json to control automatic installation of dbt dependencies during project initialization.
    • Default value is true, meaning dependencies are installed by default.
  • Implementation:
    • In DBTProject class, rebuildManifest() method checks installDepsOnProjectInitialization setting and installs dependencies if not initialized.
    • Modifies installDeps() method to accept a silent parameter to control command focus.

This description was created by Ellipsis for f85b62c. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • New Features

    • Added a configuration option to control dbt dependency installation during project initialization
    • Enhanced dependency installation process with a silent mode option
  • Configuration

    • New setting dbt.installDepsOnProjectInitialization added with default value of true

Copy link
Contributor

coderabbitai bot commented Jan 27, 2025

Walkthrough

The pull request introduces a new configuration property dbt.installDepsOnProjectInitialization in the package.json file for the dbt Power User extension. This boolean configuration controls whether dbt dependencies are automatically installed during project initialization. Correspondingly, the DBTProject class in dbtProject.ts has been updated to support this configuration, modifying the installDeps method to accept a silent parameter and conditionally install dependencies based on the new setting.

Changes

File Change Summary
package.json Added new configuration property dbt.installDepsOnProjectInitialization with boolean type and default value true
src/manifest/dbtProject.ts Updated installDeps() method signature to include silent parameter and modified dependency installation logic to respect new configuration setting

Sequence Diagram

sequenceDiagram
    participant User
    participant Extension
    participant DBTProject
    participant DependencyManager

    User->>Extension: Configure project
    Extension->>DBTProject: Initialize project
    DBTProject->>Extension: Check installDepsOnProjectInitialization
    alt Dependencies should be installed
        DBTProject->>DependencyManager: installDeps(silent)
        DependencyManager-->>DBTProject: Dependencies installed
    else Dependencies installation disabled
        DBTProject-->>Extension: Skip dependency installation
    end
Loading

Possibly related PRs

Suggested reviewers

  • saravmajestic
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to f85b62c in 32 seconds

More details
  • Looked at 50 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. src/manifest/dbtProject.ts:661
  • Draft comment:
    The installDeps function now accepts a silent parameter, which is used to set the focus property of the installDepsCommand. This change is consistent with the new configuration option dbt.installDepsOnProjectInitialization.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The function installDeps has been modified to accept a silent parameter, which is used to set the focus property of the installDepsCommand. This change is consistent with the new configuration option dbt.installDepsOnProjectInitialization.
2. src/manifest/dbtProject.ts:661
  • Draft comment:
    Please specify a return type for the installDeps function to improve code readability and maintainability.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_e0gVQpC5P2hdhyly


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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

🧹 Nitpick comments (1)
src/manifest/dbtProject.ts (1)

661-669: Add JSDoc documentation for the new parameter.

While the implementation is correct, consider adding JSDoc documentation to describe the new silent parameter and its purpose.

+/**
+ * Install dbt dependencies.
+ * @param silent When true, prevents the installation command from focusing on the terminal
+ * @returns Promise that resolves when dependencies are installed
+ */
 async installDeps(silent = false) {
   this.telemetry.sendTelemetryEvent("installDeps");
   const installDepsCommand =
     this.dbtCommandFactory.createInstallDepsCommand();
   if (silent) {
     installDepsCommand.focus = false;
   }
   return this.dbtProjectIntegration.deps(installDepsCommand);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a30ac4 and f85b62c.

📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/manifest/dbtProject.ts (2 hunks)
🔇 Additional comments (2)
package.json (1)

124-128: LGTM! Well-structured configuration property.

The new configuration property is well-defined with:

  • Clear description
  • Appropriate default value
  • Consistent naming convention
src/manifest/dbtProject.ts (1)

526-529: LGTM! Well-implemented configuration check.

The implementation correctly:

  • Retrieves the configuration with appropriate default
  • Guards against multiple initializations using the depsInitialized flag
  • Integrates smoothly with the existing rebuildManifest flow

@mdesmet mdesmet merged commit 5f446dd into master Jan 27, 2025
13 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant