samedi 29 août 2020

Clang-Tidy: Repeated branch in conditional chain

I'm trying to get my code clang-tidy clean, and it's complaining that I'm using garbage values. the task is when string_type is equalled to the if statement call the somefunc(n) in some_class function name the same as the if statement name

if (string_type == "somefun0") {
    some_class.somefun0();
} else if (string_type == "somefun1") {
    some_class.somefun1();
} else if (string_type == "somefun2") {
    some_class.somefun2();
} else if (string_type == "somefun3") {
    some_class.somefun3();
} else if (string_type == "somefun4") {
    some_class.somefun4();

this is how it goes it needs some short method

Aucun commentaire:

Enregistrer un commentaire