Fix more SonarCloud warnings (#10901)