T019: added else if detection

Issue #29 resolved
Former user created an issue

My previous correction (issue #28) was too simple. This new version is able to manage else token with or without followed by the if statement. The use cases are:

if (i == 1) {
    printf("good");
} else
    printf("bad");

if (i == 1) {
    printf("good");
} else {
    printf("good");
}

if (i == 1) {
    printf("good");
} else if (i == 2) {
    printf("good");
}

if (i == 1) {
    printf("good");
} else if (i == 2)
    printf("bad");

Comments (5)

  1. Gaëtan Lehmann

    Thanks a lot for the fix! Could you submit a pull request with that fix as well as an updated test for this rule? It would also be nice to have your name (or nickname) so we can give you the credits for your contribution :-)

  2. Gaëtan Lehmann

    I'm not sure how to use pull requests either... it doesn't seem as well made on bitbucket as it is on github. Anyway, I've fixed the test RuleT019 and pushed your commit in the main repository.

    Thanks!

  3. Log in to comment