Check that all rules have descriptions (#4315)

This commit is contained in:
Calum Young 2023-05-09 17:53:23 +01:00 committed by GitHub
parent 8dea47afc1
commit 03f141f53d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 25 additions and 14 deletions

View file

@ -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") :]