ruff icon indicating copy to clipboard operation
ruff copied to clipboard

Consider `unsafe-fixes` config value for code action / command

Open BarrensZeppelin opened this issue 1 year ago • 3 comments

It would be nice to be able to configure the ruff server to also apply unsafe fixes with the ruff.applyAutoFix command and source.fixAll.ruff code action.

BarrensZeppelin avatar Oct 28 '24 08:10 BarrensZeppelin

Hi @BarrensZeppelin

Have you tried https://docs.astral.sh/ruff/settings/#unsafe-fixes and/or https://docs.astral.sh/ruff/settings/#lint_extend-safe-fixes?

MichaReiser avatar Oct 28 '24 08:10 MichaReiser

Unsafe fixes are explicitly disabled here: https://github.com/astral-sh/ruff/blob/9f3a38d408f473df7a6b3574c5d1389bef303dd5/crates/ruff_server/src/fix.rs#L74

But I guess extend-safe-fixes could be a work-around. :thinking:

BarrensZeppelin avatar Oct 28 '24 09:10 BarrensZeppelin

Hmm, good call. I think we should respect the configuration here rather than just outright disabling it.

MichaReiser avatar Oct 28 '24 09:10 MichaReiser