Support ruff 0.5.0 in CI

Support ruff 0.5.0 in CI.

Also revert:
- #7007