mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-09 22:25:09 +00:00
Check that all rules have descriptions (#4315)
This commit is contained in:
parent
8dea47afc1
commit
03f141f53d
14 changed files with 25 additions and 14 deletions
|
@ -85,6 +85,17 @@ def format_file(
|
|||
with file.open() as f:
|
||||
contents = f.read()
|
||||
|
||||
if file.parent.name == "rules":
|
||||
# Check contents contains "What it does" section
|
||||
if "## What it does" not in contents:
|
||||
print(f"Docs for `{file.name}` are missing the `What it does` section.")
|
||||
return 1
|
||||
|
||||
# Check contents contains "Why is this bad?" section
|
||||
if "## Why is this bad?" not in contents:
|
||||
print(f"Docs for `{file.name}` are missing the `Why is this bad?` section.")
|
||||
return 1
|
||||
|
||||
# Remove everything before the first example
|
||||
contents = contents[contents.find("## Example") :]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue