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

Fix #3300 BUG: Mis-linked page #3303

Closed
wants to merge 4 commits into from

Conversation

lakshaydewan
Copy link

@lakshaydewan lakshaydewan commented Oct 19, 2024

The "Edit this Page" button on the Welcome | AsyncAPI Initiative for event-driven APIs page currently leads to a 404 error. The button's link is supposed to direct users to the source code for the documentation page but instead points to a broken URL.

Current broken link:
https://github.com/asyncapi/website/blob/master/pages/docs/index.md
Expected behavior:
The link should return a 200 response and display the source code for the documentation, allowing users to contribute edits directly via GitHub.

Changes made:

Updated the "Edit this page" button's URL to point to the correct path for contributing to the documentation.
Fixed link:
https://github.com/asyncapi/website/blob/master/markdown/docs/index.md

Summary by CodeRabbit

  • New Features
    • Updated a link in the edit page configuration to direct users to the new markdown location for improved access to resources.
  • Bug Fixes
    • Enhanced error handling and clarity in the dashboard build process, providing more informative error messages.
    • Ensured file writing operations in the dashboard script complete before proceeding, improving reliability.

Copy link

coderabbitai bot commented Oct 19, 2024

Walkthrough

The changes involve an update to the config/edit-page-config.json file, specifically modifying the href value for an entry that previously had an empty value. The href was changed from the URL pointing to the pages directory to a new URL pointing to the markdown directory, while all other entries in the file remain unchanged. Additionally, the scripts/dashboard/build-dashboard.js script was modified to enhance error handling and code clarity, including adjustments to promise management and error message formatting.

Changes

File Change Summary
config/edit-page-config.json Updated href from "https://github.com/asyncapi/website/blob/master/pages" to "https://github.com/asyncapi/website/blob/master/markdown" for an entry with an empty value.
scripts/dashboard/build-dashboard.js Enhanced error handling, improved code clarity, removed Promise import from node-fetch, standardized error messages, and ensured writeToFile is awaited in the start function.

Possibly related issues

  • [BUG] Mis-linked page #3300: The change addresses a mis-linked page issue by updating the href for editing documentation, potentially resolving 404 errors when users attempt to edit pages on GitHub.

Suggested labels

ready-to-merge

Poem

🐇 In the garden of code, a change took flight,
A link now leads to markdown, shining bright.
With a hop and a skip, we fix what was wrong,
Editing made easy, come join in the song!
So let’s celebrate this tweak with cheer,
For every small change brings the future near! 🌼


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.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 19, 2024

We require all PRs to follow Conventional Commits specification.
More details 👇🏼

 No release type found in pull request title "Fix #3300 BUG: Mis-linked page ". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Copy link

netlify bot commented Oct 19, 2024

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit eb7ca25
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/6716310826d0640008491fa5
😎 Deploy Preview https://deploy-preview-3303--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.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Oct 19, 2024

⚡️ Lighthouse report for the changes in this PR:

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

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

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: 0

🧹 Outside diff range and nitpick comments (3)
scripts/dashboard/build-dashboard.js (3)

48-50: Improved error logging in getHotDiscussions.

The use of template literals enhances the readability of the error message. This change will make debugging easier.

Consider adding more context to the error message, such as:

console.error(
  `Error parsing discussion in getHotDiscussions: ${e.message}\nDiscussion: ${JSON.stringify(
    discussion
  )}`
);

This would provide more information about where the error occurred and include the error message.


94-94: Added clarifying comment in monthsSince function.

The comment explaining the calculation of seconds in a month improves code readability.

Consider using a named constant for better maintainability:

const SECONDS_IN_MONTH = 2592000;
const months = seconds / SECONDS_IN_MONTH;

This would make the code more self-documenting and easier to update if needed.


155-155: Improved error handling and code structure in start function and module exports.

The changes enhance the script's reliability and readability:

  1. Proper awaiting of file writing operation in the start function.
  2. Improved error handling with more informative error messages.
  3. Better formatting of module exports.

These improvements contribute to a more robust and maintainable codebase.

Consider adding a more descriptive error message in the start function:

console.log('Error occurred while building the dashboard:');
console.error(e);

This would provide more context about where the error occurred in the script.

Also applies to: 161-162, 164-166, 172-172

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5ec577a and eb7ca25.

📒 Files selected for processing (1)
  • scripts/dashboard/build-dashboard.js (6 hunks)
🧰 Additional context used
🔇 Additional comments (5)
scripts/dashboard/build-dashboard.js (5)

26-30: Improved interaction count calculation for pull requests.

The addition of review counts and review comment counts to the total interactions for pull requests enhances the accuracy of the "hot discussions" calculation. This change ensures that pull requests are more fairly represented in the dashboard.


115-115: Improved rate limit warning log in getDiscussions.

The formatting changes to the rate limit warning log enhance readability and make it easier to monitor API usage. This is a good practice for preventing rate limit issues.


128-129: Enhanced error handling in getDiscussions.

The addition of error logging before re-throwing the error improves error traceability while maintaining the error propagation. This change will make debugging easier and ensure that errors are not silently caught.


140-140: Improved error handling in getDiscussionByID.

The changes enhance error handling by:

  1. Adding more context to the error message (including the discussion ID).
  2. Ensuring that errors are both logged and propagated.

These improvements are consistent with the error handling enhancements made elsewhere in the file and will aid in debugging and error tracing.

Also applies to: 143-144


Line range hint 1-172: Overall assessment of changes in build-dashboard.js

The modifications in this file significantly enhance its robustness and maintainability:

  1. Improved error handling across multiple functions, providing more context in error messages.
  2. Enhanced calculation of interaction counts for pull requests, leading to more accurate "hot discussions" rankings.
  3. Better code clarity through added comments and improved formatting.
  4. More reliable asynchronous operations, particularly in the start function.

These changes collectively contribute to a more reliable dashboard building process and easier debugging. The consistency in error handling improvements across different functions is particularly commendable.

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.

2 participants