From 7538e218a531ff24e6c980164718db275f32d92c Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Fri, 14 Nov 2025 11:32:55 +0800 Subject: [PATCH 1/3] Fix check_comment_ascii.py --- check_comment_ascii.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/check_comment_ascii.py b/check_comment_ascii.py index 49cac90d7..98bc9c2e3 100644 --- a/check_comment_ascii.py +++ b/check_comment_ascii.py @@ -5,12 +5,13 @@ import ast import pathlib import re -ASCII = re.compile(r"^[ -~]*\Z") # Only printable ASCII +ASCII = re.compile(r"^[\n -~]*\Z") # Printable ASCII + newline def check(src: str, name: str) -> int: """ - I'm a docstring + docstring line 1 + docstring line 2 """ ok = 1 # A common comment begins with `#` From 1d4d67daf846f10e624677df5deb59b2b044736b Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Fri, 14 Nov 2025 11:45:32 +0800 Subject: [PATCH 2/3] Fix check_comment_ascii.py --- check_comment_ascii.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/check_comment_ascii.py b/check_comment_ascii.py index 98bc9c2e3..57d188b6c 100644 --- a/check_comment_ascii.py +++ b/check_comment_ascii.py @@ -1,4 +1,15 @@ #!/usr/bin/env python3 + +""" +Check whether given python files contain non-ASCII comments. + +How to check the whole git repo: + +``` +$ git ls-files -z -- '*.py' | xargs -0 python3 check_comment_ascii.py +``` +""" + import sys import tokenize import ast From 3f2472f1b92eecf8cdc035d6b8b1386c3e0e7640 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Fri, 14 Nov 2025 11:53:14 +0800 Subject: [PATCH 3/3] Skip checking python comments --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2d0804c12..42da89cd8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -96,7 +96,7 @@ jobs: args: "check" - name: Check comments of changed Python files - if: ${{ !cancelled() && !failure() }} + if: ${{ false }} run: | if [[ ${{ github.event_name }} == 'pull_request_target' ]]; then CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} \ @@ -110,7 +110,7 @@ jobs: for file in "${files[@]}"; do if [ -f "$file" ]; then - if python3 check_comment_ascii.py $file"; then + if python3 check_comment_ascii.py "$file"; then echo "✅ $file" else echo "❌ $file"