Codespell ignore camelcase (#693)

This commit is contained in:
Glenn Jocher
2025-12-25 13:49:59 +01:00
committed by GitHub
parent 669f1245fd
commit cec9106cdf
6 changed files with 17 additions and 15 deletions
+3 -1
View File
@@ -232,6 +232,7 @@ runs:
continue-on-error: true # Important so that commit step can pick up changes
# Spelling ---------------------------------------------------------------------------------------------------------
# --ignore-regex '\b[a-z]+[A-Z][a-zA-Z]*\b' ignores camelCase words (e.g. repoRes, dateA) to prevent false positives
- name: Run Codespell
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && inputs.spelling == 'true' && (github.event.action == 'opened' || github.event.action == 'synchronize')
run: |
@@ -239,7 +240,8 @@ runs:
--builtin clear,rare,informal,en-GB_to_en-US \
--write-changes \
--uri-ignore-words-list * \
--ignore-words-list "cancelled,MapPin,couldn,grey,writeable,finalY,RepResNet,Idenfy,WIT,Smoot,EHR,ROUGE,ALS,iTerm,Carmel,FPR,Hach,Calle,ore,COO,MOT,crate,nd,ned,strack,dota,ane,segway,fo,gool,winn,commend,bloc,nam,afterall,skelton,goin,cann,CANN" \
--ignore-regex '\b[a-z]+[A-Z][a-zA-Z]*\b' \
--ignore-words-list "cancelled,MapPin,couldn,grey,writeable,RepResNet,Idenfy,WIT,Smoot,EHR,ROUGE,ALS,Carmel,FPR,Hach,Calle,ore,COO,MOT,crate,nd,ned,strack,dota,ane,segway,fo,gool,winn,commend,bloc,nam,afterall,skelton,goin,cann,CANN" \
--skip "*.pt,*.pth,*.torchscript,*.onnx,*.tflite,*.pb,*.bin,*.param,*.mlmodel,*.engine,*.npy,*.data*,*.csv,*pnnx*,*venv*,*translat*,*lock*,__pycache__*,*.ico,*.jpg,*.png,*.webp,*.avif,*.mp4,*.mov,/runs,/.git,./docs/??/*.md,./docs/mkdocs_??.yml"
shell: bash
continue-on-error: true
+2 -2
View File
@@ -115,7 +115,7 @@ def generate_pr_review(
continue
if len(snippet) == MAX_CONTEXT_FILE_CHARS:
snippet = f"{snippet.rstrip()}\n... (truncated)"
# Only include if within budget, include buffer for markdown noise
# Only include if within budget, include buffer for Markdown noise
estimated_cost = len(snippet) + 200
if total_chars + estimated_cost < MAX_PROMPT_CHARS:
file_contents.append(f"### {file_path}\n```\n{snippet}\n```")
@@ -155,7 +155,7 @@ def generate_pr_review(
"- Suggestions must be complete, working code with NO comments, placeholders, or explanations\n"
"- Single-line fixes only: provide 'suggestion' without 'start_line' to replace the line at 'line'\n"
"- Match the exact indentation of the original code\n"
"- Avoid triple backticks (```) in suggestions as they break markdown formatting\n\n"
"- Avoid triple backticks (```) in suggestions as they break Markdown formatting\n\n"
"SUMMARY:\n"
"- Brief overall assessment: what's good, what needs attention\n"
"- If no issues found, acknowledge the PR is clean\n\n"
+6 -6
View File
@@ -11,7 +11,7 @@ from pathlib import Path
def extract_code_blocks(markdown_content):
"""Extracts Python and Bash code blocks from markdown content using regex pattern matching."""
"""Extracts Python and Bash code blocks from Markdown content using regex pattern matching."""
# Python code blocks
py_pattern = r"^( *)```(?:python|py|\{[ ]*\.py[ ]*\.annotate[ ]*\})\n(.*?)\n\1```"
py_code_blocks = re.compile(py_pattern, re.DOTALL | re.MULTILINE).findall(markdown_content)
@@ -120,7 +120,7 @@ def process_markdown_string(
process_bash: bool = True,
verbose: bool = False,
) -> str:
"""Formats Python/Bash code blocks inside a markdown string."""
"""Formats Python/Bash code blocks inside a Markdown string."""
formatted_markdown = markdown_content
with tempfile.TemporaryDirectory() as temp_dir_name:
temp_dir = Path(temp_dir_name)
@@ -157,7 +157,7 @@ def generate_temp_filename(file_path, index, code_type):
def process_markdown_file(file_path, temp_dir, process_python=True, process_bash=True, verbose=False):
"""Processes a markdown file, extracting code blocks for formatting and updating the original file."""
"""Processes a Markdown file, extracting code blocks for formatting and updating the original file."""
try:
markdown_content = Path(file_path).read_text()
code_blocks_by_type = extract_code_blocks(markdown_content)
@@ -192,7 +192,7 @@ def process_markdown_file(file_path, temp_dir, process_python=True, process_bash
def update_markdown_file(file_path, markdown_content, temp_files):
"""Updates a markdown file with formatted code blocks."""
"""Updates a Markdown file with formatted code blocks."""
for num_spaces, original_code_block, temp_file_path, code_type in temp_files:
try:
with open(temp_file_path) as temp_file:
@@ -219,7 +219,7 @@ def update_markdown_file(file_path, markdown_content, temp_files):
def main(root_dir=Path.cwd(), process_python=True, process_bash=True, verbose=False):
"""Processes markdown files, extracts and formats code blocks, and updates the original files."""
"""Processes Markdown files, extracts and formats code blocks, and updates the original files."""
root_path = Path(root_dir)
markdown_files = list(root_path.rglob("*.md"))
temp_dir = Path("temp_code_blocks")
@@ -242,7 +242,7 @@ def main(root_dir=Path.cwd(), process_python=True, process_bash=True, verbose=Fa
if process_bash:
format_bash_with_prettier(temp_dir) # Format Bash files
# Update markdown files with formatted code blocks
# Update Markdown files with formatted code blocks
for markdown_file, markdown_content, temp_files in all_temp_files:
update_markdown_file(markdown_file, markdown_content, temp_files)
+1 -1
View File
@@ -209,7 +209,7 @@ def filter_diff_text(diff_text: str) -> tuple[str, list[str]]:
def format_skipped_files_dropdown(skipped_files: list[str], max_files: int = 100) -> str:
"""Format skipped files as a collapsible HTML details dropdown for GitHub markdown."""
"""Format skipped files as a collapsible HTML details dropdown for GitHub Markdown."""
if not skipped_files:
return ""
count = len(skipped_files)
+1 -1
View File
@@ -87,7 +87,7 @@ def filter_labels(available_labels: dict, current_labels: list | None = None, is
def get_pr_summary_guidelines() -> str:
"""Returns PR summary formatting guidelines (used by both unified PR open and PR update/merge)."""
return """Summarize this PR, focusing on major changes, their purpose, and potential impact. Keep the summary clear and concise, suitable for a broad audience. Add emojis to enliven the summary. Your response must include all 3 sections below with their markdown headers:
return """Summarize this PR, focusing on major changes, their purpose, and potential impact. Keep the summary clear and concise, suitable for a broad audience. Add emojis to enliven the summary. Your response must include all 3 sections below with their Markdown headers:
### 🌟 Summary
(single-line synopsis)
+4 -4
View File
@@ -15,7 +15,7 @@ from actions.update_markdown_code_blocks import (
def test_extract_code_blocks():
"""Test extracting code blocks from markdown content."""
"""Test extracting code blocks from Markdown content."""
# Test with Python and Bash code blocks
markdown_content = """
# Test Markdown
@@ -87,7 +87,7 @@ def test_generate_temp_filename():
@patch("pathlib.Path.write_text")
@patch("builtins.open", new_callable=mock_open)
def test_process_markdown_file(mock_file, mock_write, mock_read_text):
"""Test processing markdown files."""
"""Test processing Markdown files."""
mock_read_text.return_value = """
# Test
@@ -109,7 +109,7 @@ def test():
def test_main_real_files():
"""Test main function on actual repository markdown files."""
# Run main on current directory which contains README.md and other markdown files
"""Test main function on actual repository Markdown files."""
# Run main on current directory which contains README.md and other Markdown files
# This provides real-world test coverage of the entire pipeline
main(process_python=True, process_bash=True, verbose=False)