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

feat: add spell check workflow and configuration #92

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

navanpreet
Copy link

@navanpreet navanpreet commented Jan 8, 2025

Hey! Found this issue randomly and thought I'd make a quick PR to help out.

  • Add scripts/spellcheck.sh to run typos command
  • Create .typos.toml config file (only contains locale for now)
  • Implement a basic GH action to run crate-ci/[email protected]

Let me know if you’d like me to:

  • Add ignored paths in spellcheck/GH action
  • Include additional configuration in .typos.toml
  • Add documentation for local usage + installation of typos

Summary by CodeRabbit

  • New Features

    • Added a GitHub Actions workflow for spell checking on pull requests.
    • Introduced a spell-checking configuration file with US English locale.
    • Created a shell script to facilitate spell checking using the repository configuration.
  • Bug Fixes

    • Corrected a typo in the response message for stack component deletion.
    • Fixed a typographical error in the content security policy declaration.
  • Documentation

    • Updated the contributing guidelines to include spell-checking instructions.
    • Corrected documentation for the updateForm method parameter.
  • Chores

    • Set up automated spell-checking for the repository.

Copy link
Contributor

coderabbitai bot commented Jan 8, 2025

Walkthrough

A new spell-checking workflow has been introduced to the repository, involving the creation of a GitHub Actions workflow file, a Typos configuration file, and a supporting shell script. The workflow is designed to run spell checks automatically on pull requests using the Typos tool, with a configuration set to use US English locale. The accompanying shell script provides flexible configuration options for running the spell-check process. Additionally, minor corrections have been made in documentation and HTML content across various files.

Changes

File Change Summary
.github/workflows/spellcheck.yml New workflow added to run spell checks on pull requests using Ubuntu and Typos action
.typos.toml Added default configuration with US English locale
scripts/spellcheck.sh Updated script for enforcing repository-specific Typos configuration
CONTRIBUTING.md New section added for spellchecking contributions using Typos
bundled/tool/zenml_wrappers.py Corrected typo in delete_component method return statement
src/commands/stack/StackForm.ts Updated documentation for updateForm method parameter
src/common/panels.ts Corrected typo in HTML content for content security policy
src/test/python_tests/requirements.in Corrected typo in comment regarding package upgrades

Poem

🐰 Hop, hop, spelling's tight!
No more errors in our sight
Typos flee from our command
Checking words across the land
GitHub Actions spell it clear
Perfect prose is drawing near! 📝


📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a04b54a and 0098a3e.

📒 Files selected for processing (2)
  • .github/workflows/spellcheck.yml (1 hunks)
  • .typos.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .typos.toml
  • .github/workflows/spellcheck.yml

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.

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

🧹 Nitpick comments (2)
scripts/spellcheck.sh (2)

12-16: Enhance option parsing robustness.

Consider using getopts for more maintainable option parsing, especially if more options might be added in the future.

Here's an improved implementation:

-# Enable help flag
-if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
-    show_help
-    exit 0
-fi
+# Parse options
+while getopts ":h-:" opt; do
+    case $opt in
+        h)
+            show_help
+            exit 0
+            ;;
+        -)
+            case "${OPTARG}" in
+                help)
+                    show_help
+                    exit 0
+                    ;;
+                *)
+                    echo "Invalid option: --${OPTARG}" >&2
+                    show_help
+                    exit 1
+                    ;;
+            esac
+            ;;
+        ?)
+            echo "Invalid option: -${OPTARG}" >&2
+            show_help
+            exit 1
+            ;;
+    esac
+done
+shift $((OPTIND-1))

1-36: Add documentation and ensure proper file formatting.

The script would benefit from:

  1. A header comment block explaining its purpose and requirements
  2. A newline at the end of file

Add this documentation at the start of the file:

 #!/bin/bash
 
+# Script: spellcheck.sh
+# Purpose: Runs the typos spell checker with configurable settings
+# Requirements:
+#   - typos (https://github.com/crate-ci/typos)
+
 show_help() {

Also ensure there's a newline at the end of the file.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6872443 and ddbe04b.

📒 Files selected for processing (3)
  • .github/workflows/spellcheck.yml (1 hunks)
  • .typos.toml (1 hunks)
  • scripts/spellcheck.sh (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .typos.toml
  • .github/workflows/spellcheck.yml
🔇 Additional comments (1)
scripts/spellcheck.sh (1)

1-36: Verify path handling and GitHub Actions integration.

Please ensure:

  1. The script handles paths with spaces correctly
  2. The script integrates properly with the GitHub Action workflow

Run this verification script:

✅ Verification successful

Path handling verified, GitHub Actions integration exists via dedicated workflow

The script correctly handles paths with spaces, and spell checking is properly integrated into GitHub Actions through a dedicated spellcheck.yml workflow. No changes needed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify script behavior with spaces in paths and GitHub Actions integration

# Test 1: Check if the script is referenced in GitHub Actions workflow
echo "Checking GitHub Actions workflow integration..."
rg -l "spellcheck.sh" .github/workflows/

# Test 2: Create test files with spaces in paths
mkdir -p "test dir"
cp .typos.toml "test dir/my config.toml"
./scripts/spellcheck.sh "test dir/my config.toml"

Length of output: 359


Script:

#!/bin/bash
# Check for workflow files and typos-related configurations
echo "Checking for GitHub Actions workflows..."
fd -e yml -e yaml . .github/workflows/

echo -e "\nChecking for typos-related configurations in workflows..."
rg -l "typos" .github/workflows/

Length of output: 416

scripts/spellcheck.sh Outdated Show resolved Hide resolved
scripts/spellcheck.sh Outdated Show resolved Hide resolved
@strickvl
Copy link
Collaborator

strickvl commented Jan 8, 2025

Thank you for this submission @navanpreet! Would you mind handling (either adding to a whitelist or fixing) the typos that were picked up as well?

Documentation for usage in the CONTRIBUTING.md file would be useful, too. Thank you!

@strickvl strickvl added enhancement New feature or request CI labels Jan 8, 2025
@strickvl strickvl linked an issue Jan 8, 2025 that may be closed by this pull request
@navanpreet
Copy link
Author

Thank you for this submission @navanpreet! Would you mind handling (either adding to a whitelist or fixing) the typos that were picked up as well?

Documentation for usage in the CONTRIBUTING.md file would be useful, too. Thank you!

Will do!

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 (2)
CONTRIBUTING.md (2)

73-77: Add installation and script execution instructions.

While the command example is clear, consider adding:

  1. Instructions for installing the typos tool
  2. A note about making the script executable (e.g., chmod +x scripts/spellcheck.sh)

This will help first-time contributors get started more easily.


79-80: Enhance configuration documentation with examples.

Consider adding:

  1. An example of passing additional arguments to the script
  2. Common use cases for argument forwarding (e.g., checking specific files or directories)

Example:

For instance, to check only markdown files:
```bash
./scripts/spellcheck.sh "**/*.md"

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yml**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ddbe04bf91969ed16aeae44455462012b5ffc6f4 and a04b54a952eb5f2502a8067403ace03c15e5e453.

</details>

<details>
<summary>📒 Files selected for processing (7)</summary>

* `.typos.toml` (1 hunks)
* `CONTRIBUTING.md` (1 hunks)
* `bundled/tool/zenml_wrappers.py` (1 hunks)
* `scripts/spellcheck.sh` (1 hunks)
* `src/commands/stack/StackForm.ts` (1 hunks)
* `src/common/panels.ts` (1 hunks)
* `src/test/python_tests/requirements.in` (1 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (4)</summary>

* src/test/python_tests/requirements.in
* bundled/tool/zenml_wrappers.py
* src/commands/stack/StackForm.ts
* src/common/panels.ts

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>

* .typos.toml
* scripts/spellcheck.sh

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>CONTRIBUTING.md (1)</summary>

`71-72`: **LGTM! Well-structured section header.**

The new section is properly placed and follows the document's formatting conventions.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@navanpreet
Copy link
Author

@strickvl I slightly tweaked things based on your comment. I've made some adjustments to the implementation after thinking about the trade-offs between a wrapper script versus direct typos usage. Since the goal is to probably ensure consistent spell checking across all contributions, I changed the script to focus solely on enforcing the repository's .typos.toml configuration while still allowing all other typos arguments to pass through. IMO, this provides standardization where it matters while not taking away from typos or writing a redundant abstraction. I've also handled the flagged typos and added usage documentation. Let me know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add typos to CI
2 participants