Skip to content

Ruff format on multiple directories returns inconsistent results #21081

@OBarronCS

Description

@OBarronCS

Summary

The pwndbg project - https://github.com/pwndbg/pwndbg/ - is using ruff format to format the codebase. We have found that using ruff format will inconsistently report formatting errors when running it with multiple directories.

Reproduce

Pwndbg uses Ruff 0.4.10, however I have reproduced this with the latest version of Ruff as well. See the note at the end.

Clone the pwndbg repo on a version where this applies:

git clone --depth 1 https://github.com/pwndbg/pwndbg.git --branch 2025.10.20
cd pwndbg

Within the nested pwndbg/ directory, there are 5 files with some formatting errors.

If you run this, you will see the errors (this uses our specific version of ruff through a virtual environment with uv):

uv run --group lint ruff format --check --diff pwndbg

However, if you add additional directories to be formatted, these errors will not always be reported.

uv run --group lint ruff format --check --diff pwndbg pwndbginit tests *.py scripts

You can run it in a loop of 100, and see it prints out the diff only on rare cases:

for i in `seq 1 100`; do uv run --group lint ruff format --check --diff pwndbg pwndbginit tests *.py scripts; done

As you remove directories from the list to be formatted, the likelihood of ruff format finding the formatting errors in the pwndbg/ directory increases.

Note that if you don't use the uv virtual environment, and instead use the latest version of Ruff, 0.14.2, the same results apply. It will still find an inconsistent number of files with errors between different runs (the numbers vary from 0.4.10, as the new errors are resulting from newer versions of Ruff changing how things are formatted)

Version

0.14.2 and 0.4.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcliRelated to the command-line interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions