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

Add support for Twig and Nunjucks #8

Merged
merged 4 commits into from
Aug 19, 2024
Merged

Add support for Twig and Nunjucks #8

merged 4 commits into from
Aug 19, 2024

Conversation

j9t
Copy link
Owner

@j9t j9t commented Aug 19, 2024

Summary by CodeRabbit

  • New Features

    • Expanded the list of supported file types for the ObsoHTML tool to include Nunjucks and Twig templates.
    • Enhanced functionality for analyzing obsolete content in additional templating languages.
  • Tests

    • Introduced a new test case for detecting obsolete elements specifically in Twig files.
  • Chores

    • Updated version number from 1.5.0 to 1.6.0, indicating new features and improvements.

Included `.twig` file detection and added tests for obsolete elements within Twig templates. This enhances the tool's capability to handle and inspect more file types.

Signed-off-by: Jens Oliver Meiert <[email protected]>
Updated the README to reflect the addition of Nunjucks and Twig file scanning. This enhances the script’s capability to identify deprecated HTML within these templating languages.

Signed-off-by: Jens Oliver Meiert <[email protected]>
Update the package and lock file versions from 1.5.0 to 1.6.0. This change ensures alignment across the project files and prepares for the next release.

Signed-off-by: Jens Oliver Meiert <[email protected]>
Added a check to ensure that the 'nowrap' attribute is not incorrectly flagged as obsolete in test cases. This increases the reliability of the ObsoHTML script and ensures more accurate detection of obsolete HTML attributes.

Signed-off-by: Jens Oliver Meiert <[email protected]>
Copy link

coderabbitai bot commented Aug 19, 2024

Walkthrough

The recent updates enhance the ObsoHTML tool by expanding its capability to identify obsolete HTML elements and attributes in additional templating languages, specifically Nunjucks and Twig. The enhancements include changes to the script's file processing logic and the introduction of new test cases to validate these improvements. The version number in the package has also been incremented, reflecting these notable additions and improvements.

Changes

File Change Summary
README.md Expanded the description of ObsoHTML to include support for Nunjucks and Twig file types.
bin/obsohtml.js Modified walkDirectory function to support .njk and .twig file extensions for obsolescence detection.
bin/obsohtml.test.js Added a test case for detecting obsolete elements in Twig files, including setup and cleanup for a temporary test file.
package.json Updated version number from "1.5.0" to "1.6.0".

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.

@j9t j9t mentioned this pull request Aug 19, 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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b2e42ee and 511121b.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (4)
  • README.md (1 hunks)
  • bin/obsohtml.js (1 hunks)
  • bin/obsohtml.test.js (3 hunks)
  • package.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • README.md
  • package.json
Additional comments not posted (5)
bin/obsohtml.test.js (4)

10-10: Addition of tempTwigFile for Twig testing.

The addition of tempTwigFile is appropriate for testing Twig files. Ensure that the directory and file creation logic is robust.


20-20: Ensure content accuracy for Twig file.

The content of tempTwigFile includes the <isindex> element, which is obsolete. This setup is correct for testing purposes.


28-28: Cleanup of tempTwigFile.

The cleanup process correctly includes the removal of tempTwigFile. This ensures no residual test artifacts remain.


62-64: New test for detecting obsolete elements in Twig files.

The test case for detecting obsolete elements in Twig files is well-implemented. It complements the existing test suite by expanding coverage to Twig templates.

bin/obsohtml.js (1)

81-81: Expanded file type support in walkDirectory.

The addition of .njk and .twig to the list of file extensions broadens the scope of the script effectively. This change aligns with the PR objectives to support Twig and Nunjucks.

@j9t j9t merged commit d8574de into main Aug 19, 2024
1 check passed
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.

1 participant