Skip to content

docs: render licenses of deps in tables #91

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

Merged
merged 2 commits into from
Jan 2, 2025
Merged

docs: render licenses of deps in tables #91

merged 2 commits into from
Jan 2, 2025

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Jan 1, 2025

Also generates tables for the dependencies of the bindings using the cargo tree command.

Summary by CodeRabbit

  • New Features

    • Enhanced license documentation generation with improved table formatting.
    • Introduced a new TreeGetter class to manage dependency retrieval and documentation.
    • Restructured dependency tracking for Python and Node.js bindings.
  • Bug Fixes

    • Updated descriptions in the Node.js binding README for clarity and grammatical accuracy.
  • Refactor

    • Improved code organization and maintainability of the license generation process.

Also generates tables for the dependencies of the bindings using the `cargo tree` command.
@2bndy5 2bndy5 added the documentation Improvements or additions to documentation label Jan 1, 2025
Copy link
Contributor

coderabbitai bot commented Jan 1, 2025

Walkthrough

The pull request modifies the docs/license_gen.py script to enhance the structure and formatting of license documentation. It introduces a new TreeGetter class to encapsulate the retrieval and formatting of dependency license information. The changes standardize table formatting for dependencies, with the addition of a TABLE_HEADER variable and restructured headers for Python and Node.js bindings. The script now processes cargo tree output using a more organized approach, applying regex matching to create a structured output format for license documentation.

Changes

File Change Summary
docs/license_gen.py - Added TreeGetter class with methods for dependency processing
- Introduced TABLE_HEADER for consistent table formatting
- Restructured OPTIONAL_DEPS and binding dependency headers
- Implemented get_output() method with regex-based output processing
bindings/node/README.md - Updated descriptions for various components to enhance clarity and grammatical accuracy

Sequence Diagram

sequenceDiagram
    participant TG as TreeGetter
    participant Cargo as Cargo Tree
    participant Output as License File

    TG->>Cargo: Execute cargo tree
    Cargo-->>TG: Raw dependency output
    TG->>TG: Process output with regex
    TG->>TG: Format into structured table
    TG->>Output: Write formatted license information
Loading

Possibly related PRs

  • switch to mkdocs #50: The changes in this PR involve transitioning the documentation framework to MkDocs, which is relevant as the main PR also modifies the docs/license_gen.py file to enhance license documentation, indicating a focus on improving documentation practices.
  • docs: format LICENSE and fix typo #89: Although this PR primarily focuses on formatting the LICENSE file and fixing a typo, it is related to the main PR's emphasis on improving documentation structure and clarity, particularly in the context of license documentation.

Poem

🐰 In the realm of code, a rabbit's delight,

License gen script now shines so bright

Cargo trees now neatly arrayed

With tables and headers precisely made

Documentation's magic, clear and clean! 📜✨


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

@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

🧹 Nitpick comments (7)
docs/license_gen.py (7)

14-15: Use descriptive naming for table headers.

While TABLE_HEADER is straightforward, consider clarifying its usage in a brief docstring or inline comment for future maintainers.


27-31: Consider unifying optional and binding table sections.

Both PY_BINDING_HEADER and JS_BINDING_HEADER reuse TABLE_HEADER. It might be beneficial to unify similar references (like “## Bindings’ dependencies”) under a single pattern or function for maintainability and consistency.


33-35: Add a description for Node.js binding.

Similar to the Python binding, a short docstring or comment could clarify the reasoning for adding the Node.js binding section. This helps maintainers understand the broader context of these optional dependencies.


37-39: Clarify purpose of SELF_DEP regex.

A short inline comment explaining why SELF_DEP is necessary would make the code more self-documented. This helps future maintainers grasp its usage and potential edge cases.


55-57: Do not overwrite arguments in place without context.

package replaces the value in self.args[7] with value. To improve clarity, consider storing that string in a dedicated variable or explaining the index choice via comments. Hard-coded array indices can cause confusion if self.args changes.


58-77: Extend license replacements for comprehensive coverage.

The get_output method currently replaces only “MIT”, “Apache-2.0”, and “MPL-2.0”. Consider handling other well-known licenses or parametrize the method so new licenses can be easily extended in the future.


80-93: Add optional debugging output or logging.

When generating the MD file, consider a debug or verbose mode to print how many dependencies were found, or if the script encountered any anomalies. This may help future troubleshooting.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 23c30d9 and 83c2ca8.

📒 Files selected for processing (1)
  • docs/license_gen.py (2 hunks)
🔇 Additional comments (1)
docs/license_gen.py (1)

16-24: Check for multiline string continuity.

The f-string uses a backslash at line 22. Verify that the final output includes all table rows as intended. Sometimes, trailing backslashes can introduce unwanted whitespace or escape errors.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Jan 1, 2025

This output is a little cleaner: https://cpp-linter-rs--91.org.readthedocs.build/en/91/other-licenses/

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)
bindings/node/README.md (1)

60-60: Minor formatting suggestion for improved readability

The clarification about the package being non-binary is helpful. Consider hyphenating "platform-agnostic" for better readability.

-| `package.json` | Metadata about the npm package (platform agnostic - no binary). |
+| `package.json` | Metadata about the npm package (platform-agnostic - no binary). |
🧰 Tools
🪛 LanguageTool

[misspelling] ~60-~60: This word is normally spelled with a hyphen.
Context: ...json| Metadata about the npm package (platform agnostic - no binary). | |cli.js` | The execut...

(EN_COMPOUNDS_PLATFORM_AGNOSTIC)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37cb281 and 059eae2.

📒 Files selected for processing (1)
  • bindings/node/README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
bindings/node/README.md

[misspelling] ~60-~60: This word is normally spelled with a hyphen.
Context: ...json| Metadata about the npm package (platform agnostic - no binary). | |cli.js` | The execut...

(EN_COMPOUNDS_PLATFORM_AGNOSTIC)

🔇 Additional comments (3)
bindings/node/README.md (3)

56-56: LGTM! Improved clarity about package type

The addition of "binary" to specify the package type provides better clarity about the nature of the npm packages.


62-63: LGTM! Enhanced technical accuracy

The updated descriptions for both files are more precise and better explain their roles in the binary module ecosystem:

  • index.d.ts: Clarifies that it contains both typing and documentation info
  • index.js: Better explains its role in binary selection

64-64: LGTM! Fixed grammar and improved clarity

The description now correctly explains the native module's naming convention and its relationship to the compilation target.

@2bndy5 2bndy5 merged commit 999088d into main Jan 2, 2025
22 checks passed
@2bndy5 2bndy5 deleted the improve-licenses branch January 2, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant