Skip to content

Switch to ruff - #365

Open
Alicipy wants to merge 7 commits into
OWASP:masterfrom
Alicipy:switch-to-ruff
Open

Alicipy wants to merge 7 commits into
OWASP:masterfrom
Alicipy:switch-to-ruff

Conversation

@Alicipy

@Alicipy Alicipy commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

As already mentioned in #331, this PR will switch 'black' fully to ruff.

There was a configuration for ruff already, but black was the main formater used before. This change removes black, reformats all files, fixes some linting errors, and enforces the rules in CI as well, so no drift happens now.

@Alicipy
Alicipy requested a review from izar as a code owner August 20, 2026 16:47
@NoodlesNZ

Copy link
Copy Markdown
Contributor

LGTM

Also drop the UP007 ignore, we require Python 3.11 now.

Signed-off-by: Stefan Kraus <dev@stefankraus.org>
Signed-off-by: Stefan Kraus <dev@stefankraus.org>
Signed-off-by: Stefan Kraus <dev@stefankraus.org>
Nothing enforced formatting until now, so a few files had drifted.

Signed-off-by: Stefan Kraus <dev@stefankraus.org>
ruff finds the files on its own, so the wildcard lists can go.

Signed-off-by: Stefan Kraus <dev@stefankraus.org>
Signed-off-by: Stefan Kraus <dev@stefankraus.org>
Signed-off-by: Stefan Kraus <dev@stefankraus.org>
@Alicipy

Alicipy commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

@izar is that change to 'ruff' still wanted / needed? Just asking as when we merge in more things, we need to resolve conflicts and changes again.

@izar

izar commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

hi @Alicipy - to be honest, I am still looking for a good reason to move to ruff. In my view, black is a perfectly fine solution, while ruff brings with it the whole Go environment - at least in my Ubuntu box.
I'll be glad to be educated on the advantages.

@Alicipy

Alicipy commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Hey izar,

yes, I would love to convince you, as I personally see a lot of advantages from ruff over black, also in the current project context:

  • black is known for having some 'conflicts' with other tools, where the opinions what is 'right' differs. E.g., isort and black reorder things differently (needs config in isort), flake8/pycode and black use spaces differently, and the 'line length default' must handled at several places to be in sync
  • ruff is a 'one in all' tool and reduces the number of tools to take care of, as it includes flake8 rules, isort rules, and other tool rules in itself, not needing to take care of tools for special reasons
  • ruff is already included in the project for linting (it's a dev dependency already), we would just move formatting to it as well, removing black as a dependency

Not so relevant for the project as it's not really big, but:

  • ruff is drastically faster, but not noteworthy here.
  • ruff normally is completely compatible with black in default config (we still have some reformatting due to rules)

I don't get the point with Go unfortunately, as ruff is written in Rust and with 'pip install ruff', you get a prebuilt binary without any toolchain. Do you install it with snap, apt, or others?

If you'd still prefer black, that's fine, I was just asking for a decision so I know if we/I need to take care of this PR in any form

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants