Skip to content

Conversation

cvvergara
Copy link
Member

@cvvergara cvvergara commented Feb 27, 2025

Fixes #2765

Changes proposed in this pull request:

  • The arrays are reorganized
  • pgr_degree was missing, now its added
  • Code is simpler

@pgRouting/admins

Summary by CodeRabbit

  • New Features
    • Enhanced version history tracking with added support for removal dates.
    • Updated version records to include new entries for version 3.4.
    • Improved logic for generating historical links based on file and language parameters.

@cvvergara cvvergara added this to the Release 3.8.0 milestone Feb 27, 2025
@cvvergara cvvergara requested a review from robe2 February 27, 2025 17:37
@cvvergara cvvergara self-assigned this Feb 27, 2025
Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

Walkthrough

The changes update version-handling functions in doc/_static/page_history.js. The createInfo function now accepts an extra parameter to track file removal dates. The get_vdata function is revised with additional parameters for file and language to better determine link generation. Meanwhile, the get_history function incorporates a check for a non-empty removal date and adjusts the language validity logic based on version numbers. Additionally, a new page entry for version 3.4 is added to the newpages array.

Changes

File Change Summary
doc/_static/page_history.js - createInfo: Signature updated to include a new removedat parameter.
- get_vdata: Signature updated to accept file and lang parameters; logic modified for link determination.
- get_history: Added check for non-empty removedat and updated validity check for versions (>= 3.7).
- Added a new entry for version 3.4 in the newpages array.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CI as createInfo()
    participant GH as get_history()
    participant GV as get_vdata()

    U->>CI: Invoke createInfo(file, newat, altnames, removedat)
    CI->>GH: Forward info for version processing
    GH->>GV: Request version data (data, v, file, lang)
    GV-->>GH: Return link/data based on conditions
    GH->>U: Deliver updated file history
Loading

Poem

Hoppin' through the lines of code,
I found a tune in each new node.
A parameter here, a check there,
My ears perk up at changes fair.
Code flows smooth, my paws agree,
A rhyme from me—happy as can be! 🐇


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 083ddaa and e51e368.

📒 Files selected for processing (1)
  • doc/_static/page_history.js (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
doc/_static/page_history.js (1)
Learnt from: cvvergara
PR: pgRouting/pgrouting#2767
File: doc/_static/page_history.js:320-320
Timestamp: 2025-02-27T17:46:44.613Z
Learning: In the pgRouting documentation system, the check for Chinese Simplified language uses "zh-Hans" (with hyphen) format, but the actual directory name is "zh_Hans" (with underscore). The code in page_history.js correctly maps between these two formats.
🪛 Biome (1.9.4)
doc/_static/page_history.js

[error] 277-277: Use let or const instead of var.

A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'let' instead.

(lint/style/noVar)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (7)
doc/_static/page_history.js (7)

1-5: Function signature enhancement with removedat parameter

The addition of the removedat parameter to the createInfo function is a good improvement. This allows for tracking when a file was removed from the documentation, providing better version history management.


22-22: Good addition of 'pgr_degree' to version 3.4 pages

The addition of 'pgr_degree' to the list of pages in version 3.4 is consistent with the PR objectives to add the previously missing function.


50-52: Improved structure for spanningTree category

The updated structure for the spanningTree category properly tracks the renaming from 'spanningTree-category' to 'spanningTree-family' in version 3.7.


317-317: Improved version filtering with removal date check

The addition of the removal date check is a good enhancement. It prevents processing of versions that are beyond the removal date of a file, which helps in maintaining accurate documentation links.


320-320: Correctly implemented Chinese language handling

The code correctly handles the mapping between "zh-Hans" (with hyphen) in the language check and "zh_Hans" (with underscore) for the directory name. This is consistent with the learned context about the pgRouting documentation system.


322-323: Improved link construction with template literals

The refactoring to use template literals for string construction is a good improvement that aligns with modern JavaScript practices. The code also now uses the enhanced get_vdata function with the additional parameters.


341-341: Updated unsupported versions handling

The update to use the enhanced get_vdata function with file and language parameters improves the consistency of link generation for unsupported versions.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @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: 3

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cf9c792 and 083ddaa.

📒 Files selected for processing (1)
  • doc/_static/page_history.js (6 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
doc/_static/page_history.js

[error] 281-281: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 283-283: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 277-277: Use let or const instead of var.

A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'let' instead.

(lint/style/noVar)


[error] 322-322: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 322-322: Use let or const instead of var.

A variable declared with var is accessible in the whole body of the function. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'let' instead.

(lint/style/noVar)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: documentation (en)
🔇 Additional comments (5)
doc/_static/page_history.js (5)

1-5: Function signature and storage improvement for tracking removal dates

Good addition of the removedat parameter to the createInfo function. This enhancement allows for tracking when files were removed, which aligns with the PR objective of improving the page history logic.


22-22: Added pgr_degree to newpages

Great addition of pgr_degree to the version 3.4 pages list, which addresses the PR objective of adding the previously missing function.


50-52: Updated format for spanningTree-category

Good update to the spanningTree-category entry using the new format, which supports the cleaner array structure objective.


317-317: Improved logic for handling removed pages

Good addition of a check for removedat. This optimizes the version links generation by avoiding processing unsupported versions when a page has been removed.


323-323: Updated get_vdata function calls

The calls to get_vdata have been properly updated to pass the additional parameters needed for the enhanced link generation logic.

Also applies to: 341-341

@cvvergara cvvergara merged commit 720fe01 into pgRouting:main Feb 27, 2025
11 checks passed
@cvvergara cvvergara deleted the issue-2765-improve-page_history.js branch February 27, 2025 17:55
@github-actions github-actions bot restored the issue-2765-improve-page_history.js branch February 27, 2025 18:09
@cvvergara cvvergara deleted the issue-2765-improve-page_history.js branch February 27, 2025 23:24
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.

Improve page_history.js
2 participants