Skip auto-generated porting guides for rstcheck. (#2376) (#2379)

(cherry picked from commit 2ca9afc29e)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2025-01-28 20:20:02 +01:00
committed by GitHub
parent 8678bf88b9
commit dfdcd20af5
2 changed files with 17 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import argparse
import json
import os
import pathlib
import re
import subprocess
import sys
@@ -44,13 +45,24 @@ def run_test(name: str) -> bool:
paths = []
extensions = set(config.get('extensions', []))
ignore_regexs = [
re.compile(regex)
for regex in config.get('ignore_regexs', [])
]
for root, dir_names, file_names in os.walk(ROOT / 'docs'):
for file_name in file_names:
path = os.path.join(root, file_name)
ext = os.path.splitext(path)[1]
if ext in extensions:
paths.append(path)
rel_path = os.path.relpath(path, ROOT)
if any(regex.match(rel_path) for regex in ignore_regexs):
continue
if ext not in extensions:
continue
paths.append(path)
cmd = [sys.executable, checker_path] + paths

View File

@@ -1,5 +1,8 @@
{
"extensions": [
".rst"
],
"ignore_regexs": [
"^docs/docsite/rst/porting_guides/porting_guide_[0-9]+\\.rst$"
]
}