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

feat: integrated Coderabbit for AI powered PR reviews #3298

Merged
merged 12 commits into from
Nov 8, 2024

Conversation

aakankshabhende
Copy link
Contributor

@aakankshabhende aakankshabhende commented Oct 17, 2024

Description
Integrated coderabbit for AI powered PR reviews

Related issue(s)
Fixes #3293

Summary by CodeRabbit

  • New Features

    • Introduced a new configuration file for code review settings, enhancing the review process with options like summary generation and status tracking.
    • Enabled auto-review features, allowing specific keywords to be ignored during the review process.
    • Added tools for spell checking, markdown linting, biome analysis, and more to improve code quality.
    • Implemented an auto-reply feature for chat to enhance communication during reviews.
    • Established a knowledge base for local learnings, issues, and pull requests, with an opt-out option.
  • Bug Fixes

    • Adjusted review options to disable the request changes workflow and prevent drafts from being submitted.

Copy link

coderabbitai bot commented Oct 17, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce a new configuration file .coderrabbit.yml that outlines various settings for the code review process, including language preferences, review options, and tools for linting and spell checking. The configuration activates an auto-review feature, outlines review status tracking, and specifies that drafts are not allowed. It also includes an auto-reply feature for chat and knowledge base settings.

Changes

File Change Summary
.coderrabbit.yml New configuration file added for code review settings, including language, review options, and tools.

Assessment against linked issues

Objective Addressed Explanation
Add coderabbit configuration to the repo (#3293)

🐰 In the meadow, where bunnies play,
A new config is here today!
With reviews that hop and skip,
Code quality takes a joyful trip!
So let’s cheer for changes bright,
For smoother PRs, our hearts take flight! 🌼


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

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link

netlify bot commented Oct 17, 2024

Deploy Preview for asyncapi-website ready!

Name Link
🔨 Latest commit a5c850a
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/672e48a3f5a99800081d8d36
😎 Deploy Preview https://deploy-preview-3298--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.01%. Comparing base (0909e2f) to head (a5c850a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3298   +/-   ##
=======================================
  Coverage   59.01%   59.01%           
=======================================
  Files          21       21           
  Lines         649      649           
=======================================
  Hits          383      383           
  Misses        266      266           

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

@aakankshabhende aakankshabhende changed the title Integrated Coderabbit for AI powered PR reviews feat: Integrated Coderabbit for AI powered PR reviews Oct 17, 2024
Copy link

@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 (4)
.coderrabbit.yml (2)

14-20: Tools configuration is good, consider adding language-specific linters if needed.

The tools configuration enables important code quality tools:

  • Spellcheck and markdownlint for documentation quality
  • Biome for JavaScript, TypeScript, and JSON linting and formatting

This is a good start for maintaining code quality. However, depending on your project's tech stack, you might want to consider adding more language-specific linters.

Would you like suggestions for additional linters based on your project's primary programming languages?


21-22: Chat auto-reply is enabled, consider adding more detailed settings.

Enabling auto-reply can be useful for providing immediate feedback to contributors. However, the current configuration doesn't specify what kind of auto-replies will be sent.

Consider adding more granular control over auto-replies, such as:

  • Specific messages for different types of contributions
  • Customized greetings or instructions
  • Conditions for when to send auto-replies

Would you like help in expanding the auto-reply configuration with more detailed settings?

🧰 Tools
🪛 yamllint

[error] 22-22: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/ai-pr-review.yml (2)

1-5: LGTM! Minor formatting suggestion.

The workflow name and trigger are correctly set up. The workflow will run on pull requests targeting the master branch, which aligns with the PR objectives.

Consider removing the trailing space on line 5 to improve code cleanliness:

-    branches: [ master ]  
+    branches: [ master ]
🧰 Tools
🪛 yamllint

[error] 5-5: trailing spaces

(trailing-spaces)


11-21: LGTM! Suggestions for improvement and minor formatting fixes.

The steps are well-structured and cover all necessary actions for the AI PR review process. Here are some suggestions for improvement:

  1. Consider upgrading to the latest version of the checkout action:
-      uses: actions/checkout@v3  
+      uses: actions/checkout@v4
  1. For more reproducible builds, consider using npm ci instead of npm install:
-      run: npm install          
+      run: npm ci
  1. Remove trailing spaces on lines 13, 16, 19, and 21 for better code cleanliness.
🧰 Tools
🪛 yamllint

[error] 13-13: trailing spaces

(trailing-spaces)


[error] 16-16: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 21-21: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ec62c5e and 2c50937.

📒 Files selected for processing (2)
  • .coderrabbit.yml (1 hunks)
  • .github/workflows/ai-pr-review.yml (1 hunks)
🧰 Additional context used
🪛 yamllint
.coderrabbit.yml

[error] 22-22: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/ai-pr-review.yml

[error] 5-5: trailing spaces

(trailing-spaces)


[error] 13-13: trailing spaces

(trailing-spaces)


[error] 16-16: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 21-21: trailing spaces

(trailing-spaces)

🔇 Additional comments (4)
.coderrabbit.yml (2)

1-1: LGTM: Language setting is correct.

The language setting "en-US" is appropriate for English (United States) localization.


2-13: Reviews configuration looks good, but verify the base branch name.

The reviews configuration is well-structured and covers important aspects of the review process. The auto-review settings are particularly useful for automated PR reviews.

However, please verify that "master" is indeed the correct base branch name for your repository. Many repositories now use "main" as the default branch name.

To verify the default branch name, run the following command:

If the output is different from "master", update line 13 accordingly.

✅ Verification successful

Base branch name confirmed as "master".

The base_branches setting in your reviews configuration correctly references the repository's default branch.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the default branch name of the repository

# Test: Get the default branch name. Expect: The correct default branch name (e.g., "main" or "master")
gh repo view --json defaultBranchRef --jq .defaultBranchRef.name

Length of output: 73

.github/workflows/ai-pr-review.yml (2)

7-9: LGTM! Job definition is well-structured.

The job name ai_review is clear and descriptive. Using ubuntu-latest as the runner ensures that the workflow will always use the most up-to-date Ubuntu version, which is a good practice for security and feature availability.


1-21: Great implementation! Aligns well with PR objectives.

This GitHub Actions workflow successfully integrates Coderabbit for AI-powered PR reviews, addressing the objectives outlined in the PR summary and linked issue #3293. The implementation will help expedite the review process and improve code quality for contributors and maintainers.

A few minor suggestions have been made to improve the workflow further, including updating the checkout action version, using npm ci for more reproducible builds, and removing trailing spaces. These changes will enhance the overall quality and maintainability of the workflow.

Great job on implementing this feature!

🧰 Tools
🪛 yamllint

[error] 5-5: trailing spaces

(trailing-spaces)


[error] 13-13: trailing spaces

(trailing-spaces)


[error] 16-16: trailing spaces

(trailing-spaces)


[error] 19-19: trailing spaces

(trailing-spaces)


[error] 21-21: trailing spaces

(trailing-spaces)

.coderrabbit.yml Outdated Show resolved Hide resolved
@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 17, 2024

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 45
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-3298--asyncapi-website.netlify.app/

@aakankshabhende aakankshabhende changed the title feat: Integrated Coderabbit for AI powered PR reviews feat: integrated Coderabbit for AI powered PR reviews Oct 17, 2024
@aakankshabhende aakankshabhende marked this pull request as draft October 17, 2024 12:48
@aakankshabhende aakankshabhende marked this pull request as ready for review October 17, 2024 13:04
Copy link

@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 (2)
.coderrabbit.yml (2)

2-13: Consider adding comments for clarity.

The reviews section is well-configured and aligns with the PR objectives. To enhance readability and maintainability, consider adding comments to explain the purpose of each setting. For example:

reviews:
  # Disable the ability to request changes
  request_changes_workflow: false
  # Enable generation of a high-level summary for each review
  high_level_summary: true
  # Disable generation of review comments in poem format
  poem: false
  # Enable tracking of review status
  review_status: true
  auto_review:
    enabled: true
    # Ignore PRs with these keywords in the title
    ignore_title_keywords:
      - "WIP"
      - "Do Not Merge"
    # Don't auto-review draft PRs
    drafts: false
    # Only auto-review PRs targeting the master branch
    base_branches: ["master"]

These comments will help future maintainers understand the purpose of each configuration option.


14-20: LGTM: Tools configuration looks good.

The tools section is well-configured, enabling spellcheck, markdownlint, and biome. This aligns with the PR objectives of improving code quality.

Consider adding a comment to explain what "biome" is, as it might not be familiar to all developers:

tools:
  spellcheck:
    enabled: true
  markdownlint:
    enabled: true
  # Biome is a fast formatter, linter, and more for JavaScript, TypeScript, JSON, etc.
  biome:
    enabled: true
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2c50937 and 148fcd5.

📒 Files selected for processing (1)
  • .coderrabbit.yml (1 hunks)
🧰 Additional context used
🪛 yamllint
.coderrabbit.yml

[error] 23-23: no new line character at the end of file

(new-line-at-end-of-file)


[error] 23-23: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
.coderrabbit.yml (3)

1-1: LGTM: Language setting is appropriate.

The language setting "en-US" is correctly specified for the CodeRabbit configuration.


21-22: LGTM: Chat configuration is appropriate.

The chat section correctly enables the auto_reply feature, which aligns with the PR objectives of facilitating AI-powered reviews.


1-23: Overall, the CodeRabbit configuration looks good and aligns with the PR objectives.

The .coderrabbit.yml file is well-structured and includes appropriate settings for language, reviews, tools, and chat. It successfully addresses the goal of integrating CodeRabbit for AI-powered PR reviews as outlined in the PR objectives and linked issue #3293.

A few minor suggestions have been made to improve clarity and formatting:

  1. Adding comments to explain the purpose of various configuration options.
  2. Fixing the formatting issues at the end of the file.

These changes will enhance the maintainability and compatibility of the configuration file.

🧰 Tools
🪛 yamllint

[error] 23-23: no new line character at the end of file

(new-line-at-end-of-file)


[error] 23-23: trailing spaces

(trailing-spaces)

.coderrabbit.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@TRohit20 TRohit20 left a comment

Choose a reason for hiding this comment

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

@aakankshabhende please apply the minor suggestion made(which is valid and makes a difference).

Post which, LGTM @akshatnema @derberg

But quick question, I thought we already had a AI PR Reviewer in use?

@akshatnema
Copy link
Member

But quick question, I thought we already had a AI PR Reviewer in use?

Yeah, but this gives us a way more flexibility to configure the settings of AI code reviewer via a file.

Copy link
Member

@akshatnema akshatnema left a comment

Choose a reason for hiding this comment

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

Kindly add following tools in the configuration as well:

shellcheck:
  enabled: true
ruff:
  enabled: true
markdownlint:
  enabled: true
github-checks:
  enabled: true
  timeout_ms: 90000
languagetool:
  enabled: true
  enabled_only: false
  level: default
biome:
  enabled: true
hadolint:
  enabled: true
yamllint:
  enabled: true
gitleaks:
  enabled: true
 eslint:
  enabled: true
actionlint:
	enabled: true
semgrep:
	enabled: true

Add knowledge_base configuration as well,
like scope should be local for learnings, pull_requests and issues.

.coderrabbit.yml Outdated Show resolved Hide resolved
.coderrabbit.yml Outdated Show resolved Hide resolved
.coderrabbit.yml Show resolved Hide resolved
Copy link

@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: 3

🧹 Outside diff range and nitpick comments (2)
.coderrabbit.yml (2)

20-21: Consider increasing GitHub checks timeout.

The current timeout of 90 seconds might be insufficient for larger repositories or complex checks.

Consider increasing timeout_ms to at least 180000 (3 minutes) to prevent checks from timing out prematurely.


40-47: Consider global scope for knowledge base.

Setting all knowledge base scopes to "local" limits the AI's ability to learn from and apply insights across different repositories in your organization.

Consider using "global" scope for some features to improve learning:

 knowledge_base:
   opt_out: false
   learnings:
-    scope: "local"
+    scope: "global"
   issues:
     scope: "local"
   pull_requests:
-    scope: "local"
+    scope: "global"

This allows:

  • Sharing learnings across repositories
  • Learning from PR patterns organization-wide
  • Maintaining local scope for sensitive data like issues
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 57863e4 and 5cb721c.

📒 Files selected for processing (1)
  • .coderrabbit.yml (1 hunks)
🧰 Additional context used
📓 Learnings (1)
.coderrabbit.yml (1)
Learnt from: akshatnema
PR: asyncapi/website#3298
File: .coderrabbit.yml:2-2
Timestamp: 2024-10-23T09:13:57.844Z
Learning: When a user prefers detailed reviews including nitpicks, set `reviews.profile` to `"assertive"` in the `.coderrabbit.yml` configuration file.
🪛 yamllint
.coderrabbit.yml

[error] 16-16: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
.coderrabbit.yml (1)

4-4: Verify the impact of disabled request changes workflow.

Setting request_changes_workflow: false means Coderabbit won't be able to request changes on PRs. This might limit the effectiveness of the review process, especially for critical issues.

Consider enabling this feature to maintain a robust review process where critical issues can block PR merges.

.coderrabbit.yml Show resolved Hide resolved
.coderrabbit.yml Show resolved Hide resolved
.coderrabbit.yml Outdated Show resolved Hide resolved
@akshatnema
Copy link
Member

@coderabbitai full review

Copy link

coderabbitai bot commented Oct 25, 2024

✅ Actions performed

Full review triggered.

Copy link

@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: 2

🧹 Outside diff range and nitpick comments (1)
.coderrabbit.yml (1)

43-50: Consider broader knowledge base scope.

Setting all knowledge base scopes to "local" might limit the sharing of valuable insights across related repositories. Consider using "organization" scope if you want to share learnings across related repositories within the organization.

 knowledge_base:
   opt_out: false
   learnings:
-    scope: "local"
+    scope: "organization"
   issues:
-    scope: "local"
+    scope: "organization"
   pull_requests:
-    scope: "local"
+    scope: "organization"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ec62c5e and d308476.

📒 Files selected for processing (1)
  • .coderrabbit.yml (1 hunks)
🧰 Additional context used
📓 Learnings (1)
.coderrabbit.yml (1)
Learnt from: akshatnema
PR: asyncapi/website#3298
File: .coderrabbit.yml:2-2
Timestamp: 2024-10-23T09:13:57.844Z
Learning: When a user prefers detailed reviews including nitpicks, set `reviews.profile` to `"assertive"` in the `.coderrabbit.yml` configuration file.
🔇 Additional comments (1)
.coderrabbit.yml (1)

19-21: Consider increasing the GitHub checks timeout.

The current timeout of 180 seconds (3 minutes) might be insufficient for larger PRs or when multiple checks are running. Consider increasing this to at least 300 seconds (5 minutes) to prevent timeouts on complex reviews.

.coderrabbit.yml Show resolved Hide resolved
.coderrabbit.yml Outdated Show resolved Hide resolved
.coderrabbit.yml Outdated
Comment on lines 40 to 42
custom_messages:
greeting: "Thanks for the mention! I'll review your code shortly."
farewell: "I've completed the review. Let me know if you need any clarification!"
Copy link
Member

Choose a reason for hiding this comment

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

@aakankshabhende I don't find these fields under coderabbit ai yaml configuration. Can you please confirm how it will help and work in the PR?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akshatnema the coderrabbit bot requested these changes

Copy link
Member

Choose a reason for hiding this comment

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

@aakankshabhende Can you please point that review message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@akshatnema please check coderabbit bot's above comment

@akshatnema
Copy link
Member

@aakankshabhende any updates on this?

@akshatnema
Copy link
Member

@coderabbitai resolve

Copy link

coderabbitai bot commented Nov 8, 2024

✅ Actions performed

Comments resolved.

@akshatnema
Copy link
Member

@coderabbitai full review

Copy link

coderabbitai bot commented Nov 8, 2024

✅ Actions performed

Full review triggered.

.coderrabbit.yml Outdated Show resolved Hide resolved
@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 79b2491 into asyncapi:master Nov 8, 2024
18 of 19 checks passed
@Shaunak-Pandya
Copy link

Good work @aakankshabhende

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

Successfully merging this pull request may close these issues.

[FEATURE] Add coderabbit configuration to the repo
6 participants