mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-27 02:16:54 +00:00
Explain check_docs_formatted.py error message (#6125)
## Summary This is an error message only change to lead an implementor of a new rule that has an unformatted or invalid bad example to the right code. ## Test Plan n/a
This commit is contained in:
parent
13af91299d
commit
2a65e6fc38
1 changed files with 7 additions and 3 deletions
|
|
@ -146,15 +146,19 @@ def format_file(
|
||||||
if errors and not args.skip_errors and not error_known:
|
if errors and not args.skip_errors and not error_known:
|
||||||
for error in errors:
|
for error in errors:
|
||||||
rule_name = file.name.split(".")[0]
|
rule_name = file.name.split(".")[0]
|
||||||
print(f"Docs parse error for `{rule_name}` docs: {error}")
|
print(
|
||||||
|
f"Docs parse error for `{rule_name}` docs. Either fix or add to "
|
||||||
|
f"`KNOWN_PARSE_ERRORS`. {error}",
|
||||||
|
)
|
||||||
|
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
if contents != new_contents:
|
if contents != new_contents:
|
||||||
rule_name = file.name.split(".")[0]
|
rule_name = file.name.split(".")[0]
|
||||||
print(
|
print(
|
||||||
f"Rule `{rule_name}` docs are not formatted. The example section "
|
f"Rule `{rule_name}` docs are not formatted. Either format the rule or add "
|
||||||
f"should be rewritten to:",
|
f"to `KNOWN_FORMATTING_VIOLATIONS`. The example section should be "
|
||||||
|
f"rewritten to:",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add indentation so that snipped can be copied directly to docs
|
# Add indentation so that snipped can be copied directly to docs
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue