Skip to content

Conversation

@lambdalisue
Copy link
Member

@lambdalisue lambdalisue commented Aug 3, 2024

Close #249

Summary by CodeRabbit

  • New Features

    • Introduced a new input parameter for branch selection in the workflow, improving flexibility for testing.
    • Added new checks to ensure consistency in the codebase and updated version specifications for Deno.
  • Documentation

    • Enhanced the README with new badges indicating minimum version requirements for Deno, Vim, and Neovim.
  • Chores

    • Added a new command in the deno configuration for applying supported versions through a dedicated script.

@coderabbitai
Copy link

coderabbitai bot commented Aug 3, 2024

Warning

Rate limit exceeded

@lambdalisue has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 26 minutes and 54 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 64aaefc and 45ec29b.

Walkthrough

The updates to the repository enhance configuration and version management through the introduction of new scripts and modifications in the GitHub Actions workflow. A new input for specifying branches for testing with Denops, improved version checks, and dynamic version retrieval from JSON sources significantly enhance maintainability and flexibility. Overall, these changes ensure consistency across documentation and CI/CD configurations, making it easier for developers to manage dependencies.

Changes

Files Change Summary
.github/workflows/test.yml Added denops_branch input for workflow dispatch; introduced new checks for version consistency.
.scripts/apply-supported-versions.ts New script updates version info in README and GitHub workflows, integrating asynchronous loading of supported versions.
.scripts/gen-function/gen-function.ts, .scripts/gen-option/gen-option.ts Replaced hardcoded version constants with dynamic values from loadSupportedVersions().
.scripts/supported_versions.ts Defined a module to manage and load supported versions for Deno, Vim, and Neovim with type safety.
README.md Added badges indicating minimum version requirements for Deno, Vim, and Neovim.
deno.jsonc Introduced a new command "apply:supported-versions" to run the version update script.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant Update Script
    participant Supported Versions Module

    User->>GitHub Actions: Trigger workflow
    GitHub Actions->>Supported Versions Module: Load supported versions
    Supported Versions Module->>GitHub Actions: Return versions
    GitHub Actions->>Update Script: Update README and workflows with new versions
    Update Script->>GitHub Actions: Successful update
    GitHub Actions->>User: Notify completion
Loading

🐇 In the meadow, changes abound,
With versions dancing all around.
A script to guide, a badge to show,
Our code's in sync, watch it grow!
Hopping forward, no more despair,
With each new version, we declare! 🌼


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 as 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.

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

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.

@lambdalisue lambdalisue force-pushed the check-supported-versions branch from 64aaefc to 45ec29b Compare August 3, 2024 09:00
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.

Caution

Inline review comments failed to post

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e7df460 and 64aaefc.

Files selected for processing (7)
  • .github/workflows/test.yml (4 hunks)
  • .scripts/apply-supported-versions.ts (1 hunks)
  • .scripts/gen-function/gen-function.ts (1 hunks)
  • .scripts/gen-option/gen-option.ts (1 hunks)
  • .scripts/supported_versions.ts (1 hunks)
  • README.md (1 hunks)
  • deno.jsonc (1 hunks)
Files skipped from review due to trivial changes (1)
  • README.md
Additional comments not posted (15)
.scripts/supported_versions.ts (4)

3-7: Type definition looks good.

The SupportedVersions type definition correctly specifies the structure for supported versions.


9-13: Type guard looks good.

The isSupportedVersions function correctly validates the structure of the supported versions.


15-19: Function looks good.

The getSupportedVersionJsonUrl function correctly constructs the URL for fetching the supported versions JSON file.


21-30: Function looks good.

The loadSupportedVersions function correctly fetches and validates the supported versions JSON file.

.scripts/apply-supported-versions.ts (2)

6-10: Function looks good.

The main function correctly loads the supported versions and updates the README and GitHub workflows.


82-89: Script block looks good.

The main script block correctly handles running the script and error handling.

.scripts/gen-option/gen-option.ts (1)

7-11: Code segment looks good.

The code segment correctly loads supported versions and defines constants for VIM_VERSION and NVIM_VERSION, improving maintainability and flexibility.

.github/workflows/test.yml (5)

14-18: Add input parameter for denops_branch.

The new input parameter denops_branch allows specifying a branch for Denops testing. This enhances flexibility in testing different branches.


24-26: Add environment variable DENOPS_BRANCH.

The new environment variable DENOPS_BRANCH captures the input for use in subsequent steps, improving configurability.


55-62: Add new checks for gen and supported version inconsistency.

The new steps ensure that the generated code is up-to-date and that there are no inconsistencies in the supported versions. This adds robustness to the workflow.


72-72: Specify exact deno_version for testing.

Changing from "1.45.x" to "1.45.0" ensures that a specific version of Deno is used for testing, which can help avoid issues with version discrepancies.


96-96: Use environment variable for switching Denops branch.

Using the environment variable ${{ env.DENOPS_BRANCH }} enhances flexibility in branch management for Denops.

deno.jsonc (1)

93-93: Add new command for applying supported versions.

The new command "apply:supported-versions" allows execution of a script to apply supported versions, enhancing the configuration's functionality.

.scripts/gen-function/gen-function.ts (2)

7-7: Import loadSupportedVersions function.

The new import statement brings in the loadSupportedVersions function, which will be used to dynamically fetch supported versions.


9-11: Dynamically fetch supported versions.

The supportedVersions object is fetched asynchronously, and the VIM and NVIM versions are extracted from it. This change enhances flexibility and maintainability by allowing the code to adapt to version updates without manual changes.

Comments failed to post (2)
.scripts/apply-supported-versions.ts

59-79: Refactor repetitive replacements.

The updateGithubWorkflowsTest function performs repetitive replacements that can be refactored into a loop for better maintainability.

async function updateGithubWorkflowsTest(
  supportedVersions: SupportedVersions,
): Promise<void> {
  const url = new URL(import.meta.resolve("../.github/workflows/test.yml"));
  let text = await Deno.readTextFile(url);

  const replacements = [
    { regex: /deno_version:(.*?)"\d+\.\d+\.\d+"/s, value: `deno_version:$1"${supportedVersions.deno}"` },
    { regex: /vim:(.*?)"v\d+\.\d+\.\d+"/s, value: `vim:$1"v${supportedVersions.vim}"` },
    { regex: /nvim:(.*?)"v\d+\.\d+\.\d+"/s, value: `nvim:$1"v${supportedVersions.neovim}"` },
  ];

  for (const { regex, value } of replacements) {
    text = text.replace(regex, value);
  }

  await Deno.writeTextFile(url, text);
}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

async function updateGithubWorkflowsTest(
  supportedVersions: SupportedVersions,
): Promise<void> {
  const url = new URL(import.meta.resolve("../.github/workflows/test.yml"));
  let text = await Deno.readTextFile(url);

  const replacements = [
    { regex: /deno_version:(.*?)"\d+\.\d+\.\d+"/s, value: `deno_version:$1"${supportedVersions.deno}"` },
    { regex: /vim:(.*?)"v\d+\.\d+\.\d+"/s, value: `vim:$1"v${supportedVersions.vim}"` },
    { regex: /nvim:(.*?)"v\d+\.\d+\.\d+"/s, value: `nvim:$1"v${supportedVersions.neovim}"` },
  ];

  for (const { regex, value } of replacements) {
    text = text.replace(regex, value);
  }

  await Deno.writeTextFile(url, text);
}

12-57: Refactor repetitive replacements.

The updateREADME function performs repetitive replacements that can be refactored into a loop for better maintainability.

async function updateREADME(
  supportedVersions: SupportedVersions,
): Promise<void> {
  const url = new URL(import.meta.resolve("../README.md"));
  let text = await Deno.readTextFile(url);

  const replacements = [
    { regex: /Deno\s+\d+\.\d+\.\d+/, value: `Deno ${supportedVersions.deno}` },
    { regex: /Deno-Support%20\d+\.\d+\.\d+/, value: `Deno-Support%20${supportedVersions.deno}` },
    { regex: /https:\/\/github\.com\/denoland\/deno\/tree\/v\d+\.\d+\.\d+/, value: `https://github.com/denoland/deno/tree/v${supportedVersions.deno}` },
    { regex: /Vim\s+\d+\.\d+\.\d+/, value: `Vim ${supportedVersions.vim}` },
    { regex: /Vim-Support%20\d+\.\d+\.\d+/, value: `Vim-Support%20${supportedVersions.vim}` },
    { regex: /https:\/\/github\.com\/vim\/vim\/tree\/v\d+\.\d+\.\d+/, value: `https://github.com/vim/vim/tree/v${supportedVersions.vim}` },
    { regex: /Neovim\s+\d+\.\d+\.\d+/, value: `Neovim ${supportedVersions.neovim}` },
    { regex: /Neovim-Support%20\d+\.\d+\.\d+/, value: `Neovim-Support%20${supportedVersions.neovim}` },
    { regex: /https:\/\/github\.com\/neovim\/neovim\/tree\/v\d+\.\d+\.\d+/, value: `https://github.com/neovim/neovim/tree/v${supportedVersions.neovim}` },
  ];

  for (const { regex, value } of replacements) {
    text = text.replace(regex, value);
  }

  await Deno.writeTextFile(url, text);
}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

async function updateREADME(
  supportedVersions: SupportedVersions,
): Promise<void> {
  const url = new URL(import.meta.resolve("../README.md"));
  let text = await Deno.readTextFile(url);

  const replacements = [
    { regex: /Deno\s+\d+\.\d+\.\d+/, value: `Deno ${supportedVersions.deno}` },
    { regex: /Deno-Support%20\d+\.\d+\.\d+/, value: `Deno-Support%20${supportedVersions.deno}` },
    { regex: /https:\/\/github\.com\/denoland\/deno\/tree\/v\d+\.\d+\.\d+/, value: `https://github.com/denoland/deno/tree/v${supportedVersions.deno}` },
    { regex: /Vim\s+\d+\.\d+\.\d+/, value: `Vim ${supportedVersions.vim}` },
    { regex: /Vim-Support%20\d+\.\d+\.\d+/, value: `Vim-Support%20${supportedVersions.vim}` },
    { regex: /https:\/\/github\.com\/vim\/vim\/tree\/v\d+\.\d+\.\d+/, value: `https://github.com/vim/vim/tree/v${supportedVersions.vim}` },
    { regex: /Neovim\s+\d+\.\d+\.\d+/, value: `Neovim ${supportedVersions.neovim}` },
    { regex: /Neovim-Support%20\d+\.\d+\.\d+/, value: `Neovim-Support%20${supportedVersions.neovim}` },
    { regex: /https:\/\/github\.com\/neovim\/neovim\/tree\/v\d+\.\d+\.\d+/, value: `https://github.com/neovim/neovim/tree/v${supportedVersions.neovim}` },
  ];

  for (const { regex, value } of replacements) {
    text = text.replace(regex, value);
  }

  await Deno.writeTextFile(url, text);
}

@codecov
Copy link

codecov bot commented Aug 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.61%. Comparing base (e7df460) to head (45ec29b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #255   +/-   ##
=======================================
  Coverage   82.61%   82.61%           
=======================================
  Files          57       57           
  Lines        2979     2979           
  Branches      251      251           
=======================================
  Hits         2461     2461           
  Misses        516      516           
  Partials        2        2           

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

@lambdalisue lambdalisue merged commit c8f7466 into main Aug 3, 2024
@lambdalisue lambdalisue deleted the check-supported-versions branch August 3, 2024 09:05
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.

Add CI check for synchronizing Vim/Neovim versions for gen functions

2 participants