mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-09 22:25:09 +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:
|
||||
for error in errors:
|
||||
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
|
||||
|
||||
if contents != new_contents:
|
||||
rule_name = file.name.split(".")[0]
|
||||
print(
|
||||
f"Rule `{rule_name}` docs are not formatted. The example section "
|
||||
f"should be rewritten to:",
|
||||
f"Rule `{rule_name}` docs are not formatted. Either format the rule or add "
|
||||
f"to `KNOWN_FORMATTING_VIOLATIONS`. The example section should be "
|
||||
f"rewritten to:",
|
||||
)
|
||||
|
||||
# Add indentation so that snipped can be copied directly to docs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue