mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
![]() **Summary** Insert a newline after nested function and class definitions, unless there is a trailing own line comment. We need to e.g. format ```python if platform.system() == "Linux": if sys.version > (3, 10): def f(): print("old") else: def f(): print("new") f() ``` as ```python if platform.system() == "Linux": if sys.version > (3, 10): def f(): print("old") else: def f(): print("new") f() ``` even though `f()` is directly preceded by an if statement, not a function or class definition. See the comments and fixtures for trailing own line comment handling. **Test Plan** I checked that the new content of `newlines.py` matches black's formatting. --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com> |
||
---|---|---|
.. | ||
visitor | ||
all.rs | ||
call_path.rs | ||
comparable.rs | ||
docstrings.rs | ||
expression.rs | ||
hashable.rs | ||
helpers.rs | ||
identifier.rs | ||
imports.rs | ||
int.rs | ||
lib.rs | ||
node.rs | ||
nodes.rs | ||
parenthesize.rs | ||
relocate.rs | ||
statement_visitor.rs | ||
stmt_if.rs | ||
str.rs | ||
traversal.rs | ||
types.rs | ||
visitor.rs | ||
whitespace.rs |