Skip to content

Formatter inserts trailing newline at the end of a file even when inside a fmt: off region #19492

@MilkClouds

Description

@MilkClouds

Summary

title is all.

you can test this bug with:

# fmt: off
print(1,2,3,4,5,9,13518,8315987831959831,3851758979515,31958139573175915,158315897151935,135815798151,)

make sure end of file does not contain newline. run ruff format. then newline is inserted.

Version

ruff 0.12.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingformatterRelated to the formattersuppressionRelated to supression of violations e.g. noqa

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions