Consider adding a fix for pytest-raises-ambiguous-pattern
(RUF043
)
#16690
Labels
fixes
Related to suggested fixes for violations
It's certainly a more noisy rule and it's unfortunate we can't provide an auto fix (because Ruff can't know what the desired behavior is). But I think it's fine to stabilize
Unless we want to add a heuristic for the auto fix. E.g.:
.
is probably a sentence -> escape it.*
or.+
) is probably a regex -> make it raw. We can limit it to only support some specific patterns.The first fix would have to be unsafe because it does change the program's semantics. The second one could be safe but I think it's still best to make user explicitly opt-in. We could document the heuristics in the rule and having a fix could reduce the churn for users.
I'd postpone the promotion to stable if the suggested fix does sound reasonable (CC: @AlexWaygood)
Originally posted by @MichaReiser in #16657 (review)
The text was updated successfully, but these errors were encountered: