-
Notifications
You must be signed in to change notification settings - Fork 253
Fix Vale prose errors across documentation #3541
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
Open
edmundmiller
wants to merge
3
commits into
fix/vale-configuration-improvements
Choose a base branch
from
fix/vale-prose-errors
base: fix/vale-configuration-improvements
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't add any cc specific files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| #!/usr/bin/env bash | ||
| # Claude Code Post-Tool Hook | ||
| # Runs after Claude uses Write, Edit, or MultiEdit tools | ||
| # Automatically formats files with prettier and checks prose with Vale | ||
|
|
||
| # Source utilities | ||
| source "$(dirname "$0")/utils.sh" | ||
|
|
||
| # Get hook input from Claude | ||
| HOOK_DATA="$1" | ||
|
|
||
| # Extract tool name and file paths from the hook data | ||
| TOOL_NAME=$(echo "$HOOK_DATA" | jq -r '.tool_name // empty' 2>/dev/null) | ||
| FILE_PATHS=$(echo "$HOOK_DATA" | jq -r '.file_paths[]? // empty' 2>/dev/null) | ||
|
|
||
| # If we can't parse JSON, try to extract file paths from environment or arguments | ||
| if [ -z "$FILE_PATHS" ] && [ -n "$CLAUDE_MODIFIED_FILES" ]; then | ||
| FILE_PATHS="$CLAUDE_MODIFIED_FILES" | ||
| elif [ -z "$FILE_PATHS" ] && [ $# -gt 1 ]; then | ||
| shift # Remove first argument (hook data) | ||
| FILE_PATHS="$*" | ||
| fi | ||
|
|
||
| # If still no files, try to detect recently modified files | ||
| if [ -z "$FILE_PATHS" ]; then | ||
| FILE_PATHS=$(get_recent_files) | ||
| fi | ||
|
|
||
| # Exit if no files to process | ||
| if [ -z "$FILE_PATHS" ]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| print_header "Post-Tool Formatting & Linting" | ||
|
|
||
| echo "🔧 Tool used: ${TOOL_NAME:-unknown}" | ||
| echo "📁 Processing files:" | ||
|
|
||
| # Convert FILE_PATHS to array and process each file | ||
| processed_any=false | ||
| vale_issues=false | ||
|
|
||
| # Handle both space-separated and newline-separated file lists | ||
| while IFS= read -r file; do | ||
| # Skip empty lines | ||
| [ -z "$file" ] && continue | ||
|
|
||
| # Skip if file doesn't exist | ||
| [ ! -f "$file" ] && continue | ||
|
|
||
| echo " → $file" | ||
|
|
||
| # Format with prettier | ||
| if format_file "$file"; then | ||
| processed_any=true | ||
| fi | ||
|
|
||
| # Lint with Vale | ||
| if ! lint_file "$file"; then | ||
| vale_issues=true | ||
| fi | ||
|
|
||
| echo "" | ||
| done <<< "$(echo "$FILE_PATHS" | tr ' ' '\n')" | ||
|
|
||
| # Summary | ||
| if [ "$processed_any" = true ]; then | ||
| echo "🎯 File processing complete!" | ||
|
|
||
| if [ "$vale_issues" = true ]; then | ||
| echo "" | ||
| echo "📚 Vale found some prose suggestions above. These help ensure:" | ||
| echo " • Consistent terminology (nf-core, Nextflow, etc.)" | ||
| echo " • Clear, readable documentation" | ||
| echo " • Professional writing style" | ||
| echo "" | ||
| echo "💡 Consider reviewing and addressing these suggestions for better documentation quality." | ||
| else | ||
| echo "✨ All prose checks passed - excellent writing!" | ||
| fi | ||
| else | ||
| echo "ℹ️ No eligible files found to process" | ||
| fi | ||
|
|
||
| print_separator | ||
| echo "✅ Hook execution complete" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/usr/bin/env bash | ||
| # Claude Code User Prompt Submit Hook | ||
| # Runs when user submits a prompt | ||
| # Provides quick prose quality check on recently modified documentation | ||
|
|
||
| # Source utilities | ||
| source "$(dirname "$0")/utils.sh" | ||
|
|
||
| # Get user prompt from arguments | ||
| USER_PROMPT="$1" | ||
|
|
||
| # Only run if the prompt is related to documentation/writing | ||
| # Check for common documentation keywords | ||
| if ! echo "$USER_PROMPT" | grep -qi -E "(document|write|edit|readme|guide|tutorial|prose|content|markdown|mdx|vale|style|writing|docs)"; then | ||
| # Not a documentation-related prompt, exit silently | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Get recently modified documentation files | ||
| RECENT_FILES=$(find . \( -name "*.md" -o -name "*.mdx" \) -newermt '10 minutes ago' 2>/dev/null | head -5) | ||
|
|
||
| # If no recent files, exit silently | ||
| if [ -z "$RECENT_FILES" ]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| print_header "Documentation Quality Check" | ||
|
|
||
| echo "🔍 Checking recently modified documentation files for prose quality..." | ||
| echo "" | ||
|
|
||
| issues_found=false | ||
| files_checked=0 | ||
|
|
||
| while IFS= read -r file; do | ||
| [ -z "$file" ] && continue | ||
| [ ! -f "$file" ] && continue | ||
|
|
||
| # Skip API reference files (they're ignored in Vale config anyway) | ||
| if echo "$file" | grep -q "api_reference"; then | ||
| continue | ||
| fi | ||
|
|
||
| # Skip old events (they're ignored in Vale config anyway) | ||
| if echo "$file" | grep -qE "events/(2018|2019|2020|2021|2022|2023|2024)/"; then | ||
| continue | ||
| fi | ||
|
|
||
| files_checked=$((files_checked + 1)) | ||
| echo "📄 Checking: $file" | ||
|
|
||
| if ! check_tool "vale"; then | ||
| echo " ⚠️ Vale not available for prose checking" | ||
| continue | ||
| fi | ||
|
|
||
| # Quick Vale check | ||
| vale_output=$(vale --config=.vale.ini "$file" 2>&1) | ||
| vale_exit_code=$? | ||
|
|
||
| if [ $vale_exit_code -eq 0 ]; then | ||
| echo " ✅ Prose quality looks good" | ||
| else | ||
| issues_found=true | ||
| echo " 📝 Found prose suggestions:" | ||
| echo "$vale_output" | sed 's/^/ /' | ||
| fi | ||
| echo "" | ||
| done <<< "$RECENT_FILES" | ||
|
|
||
| # Summary for Claude | ||
| if [ $files_checked -eq 0 ]; then | ||
| echo "ℹ️ No recent documentation files found to check" | ||
| elif [ "$issues_found" = true ]; then | ||
| echo "📊 Summary: Found some prose suggestions in recent documentation." | ||
| echo "💡 Consider these suggestions to improve clarity and consistency." | ||
| echo "🎯 Common improvements: terminology consistency, readability, style." | ||
| else | ||
| echo "✨ Summary: All recent documentation looks great!" | ||
| echo "🎉 No prose issues found in recently modified files." | ||
| fi | ||
|
|
||
| print_separator | ||
| echo "🤖 Ready to help with your documentation request!" | ||
| echo "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| #!/usr/bin/env bash | ||
| # Utility functions for Claude Code hooks | ||
|
|
||
| # Check if a tool is available | ||
| check_tool() { | ||
| local tool="$1" | ||
| if ! command -v "$tool" &> /dev/null; then | ||
| echo "⚠️ $tool not found - skipping" | ||
| return 1 | ||
| fi | ||
| return 0 | ||
| } | ||
|
|
||
| # Check if file should be processed based on extension | ||
| should_process_file() { | ||
| local file="$1" | ||
| case "$file" in | ||
| *.md|*.mdx|*.js|*.ts|*.astro|*.svelte|*.css|*.scss|*.json|*.yml|*.yaml) | ||
| return 0 | ||
| ;; | ||
| *) | ||
| return 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| # Check if file should be linted with Vale | ||
| should_lint_with_vale() { | ||
| local file="$1" | ||
| case "$file" in | ||
| *.md|*.mdx) | ||
| return 0 | ||
| ;; | ||
| *) | ||
| return 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| # Format file with prettier if available | ||
| format_file() { | ||
| local file="$1" | ||
|
|
||
| if ! check_tool "prettier"; then | ||
| return 1 | ||
| fi | ||
|
|
||
| if ! should_process_file "$file"; then | ||
| return 1 | ||
| fi | ||
|
|
||
| echo "🎨 Formatting $file with prettier..." | ||
| if prettier --write --log-level=error "$file" 2>/dev/null; then | ||
| echo "✅ Formatted successfully" | ||
| return 0 | ||
| else | ||
| echo "❌ Prettier formatting failed" | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| # Lint file with Vale if available | ||
| lint_file() { | ||
| local file="$1" | ||
|
|
||
| if ! check_tool "vale"; then | ||
| return 1 | ||
| fi | ||
|
|
||
| if ! should_lint_with_vale "$file"; then | ||
| return 1 | ||
| fi | ||
|
|
||
| echo "📝 Checking prose quality with Vale..." | ||
|
|
||
| # Run Vale and capture output | ||
| local vale_output | ||
| vale_output=$(vale --config=.vale.ini "$file" 2>&1) | ||
| local vale_exit_code=$? | ||
|
|
||
| if [ $vale_exit_code -eq 0 ]; then | ||
| echo "✅ Vale: No prose issues found" | ||
| return 0 | ||
| else | ||
| echo "📊 Vale found prose suggestions:" | ||
| echo "$vale_output" | sed 's/^/ /' | ||
| echo "" | ||
| echo "💡 These suggestions help improve documentation clarity and consistency." | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| # Get list of recently modified files (in last 5 minutes) | ||
| get_recent_files() { | ||
| find . \( -name "*.md" -o -name "*.mdx" -o -name "*.js" -o -name "*.ts" -o -name "*.astro" -o -name "*.yml" -o -name "*.yaml" \) -newermt '5 minutes ago' 2>/dev/null | head -10 | ||
| } | ||
|
|
||
| # Pretty print a separator | ||
| print_separator() { | ||
| echo "" | ||
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | ||
| echo "" | ||
| } | ||
|
|
||
| # Print hook header | ||
| print_header() { | ||
| local hook_name="$1" | ||
| echo "" | ||
| echo "🤖 Claude Code Hook: $hook_name" | ||
| print_separator | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Local Netlify folder | ||
| .netlify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -32,7 +32,7 @@ Instructions for [nf-core pipeline](https://github.com/nf-core/proposals) approv | |||||
| 11. [ ] Core/Dev: Sync the nf-co.re pipelines page by triggering the [GitHub action](https://github.com/nf-core/website/actions/workflows/build-json-files.yml) | ||||||
| - Website repo > Actions > Build json files and md-cache > Run workflow > From main. | ||||||
|
|
||||||
| ## Uploading test data to s3 bucket | ||||||
| ## Uploading test data to S3 bucket | ||||||
|
|
||||||
| Instructions for uploading full-test AWS files for a pipeline to a S3 bucket: | ||||||
|
|
||||||
|
|
@@ -62,9 +62,9 @@ Instructions for uploading full-test AWS files for a pipeline to a S3 bucket: | |||||
| 6. Select **Create** at the bottom of the page. Do not modify any fields. | ||||||
| 7. Repeat the import (step 5) and create (step 6) steps for each JSON file provided. | ||||||
|
|
||||||
| ## Making custom docker containers for modules | ||||||
| ## Making custom Docker containers for modules | ||||||
|
|
||||||
| Instructions for adding custom docker containers to the nf-core [https://quay.io](https://quay.io/organization/nf-core) organisation. | ||||||
| Instructions for adding custom Docker containers to the nf-core [https://quay.io](https://quay.io/organization/nf-core) organisation. | ||||||
|
|
||||||
| :::note | ||||||
| These instructions require the person building and pushing the container to have push rights to the organization. | ||||||
|
|
@@ -130,7 +130,7 @@ Before release: | |||||
|
|
||||||
| Post release: | ||||||
|
|
||||||
| 1. [ ] Select **Github** in the dropdown menu of your account in Zenodo and find the relevant repository. | ||||||
| 1. [ ] Select **GitHub** in the dropdown menu of your account in Zenodo and find the relevant repository. | ||||||
| 2. [ ] Click the Zenodo **Record** page for the release. | ||||||
| 3. [ ] Find the **Communities** box on the record page and submit the record to the nf-core community. | ||||||
| 4. [ ] Copy the DOI for **Cite all versions?** in the **Versions** tab. | ||||||
|
|
@@ -141,12 +141,12 @@ Post release: | |||||
|
|
||||||
| ## Adding new community member to the GitHub organisation | ||||||
|
|
||||||
| Anyone can request to join the nf-core GitHub organisation via the #github-invitations channel. | ||||||
| Anyone can request to join the nf-core GitHub organisation via the #GitHub-invitations channel. | ||||||
|
|
||||||
| 1. [ ] Verify the request is reasonable (i.e., clearly not spam). | ||||||
| 2. [ ] Send an invitation via [nf-core github teams](https://github.com/orgs/nf-core/teams) | ||||||
| 2. [ ] Send an invitation via [nf-core GitHub teams](https://github.com/orgs/nf-core/teams) | ||||||
| 3. [ ] Add new member to the [nf-core contributors team](https://github.com/orgs/nf-core/teams/contributors) | ||||||
| 4. [ ] Respond to the #github-invitations channel request by reacting with the ✅ emoji. | ||||||
| 4. [ ] Respond to the #GitHub-invitations channel request by reacting with the ✅ emoji. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## Updating online bingo cards | ||||||
|
|
||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we not loosing a lot of things then with disabling the vale.terms? in all these files, also below