alx-tools / Betty

Holberton-style C code checker written in Perl
GNU General Public License v3.0
1.26k stars 1.77k forks source link

Fix: Handle nested single line scopes #30

Closed Mattrack closed 4 years ago

Mattrack commented 4 years ago

Betty should recognize nested single-line scopes after conditions, like the following:

if (1 < 1 + 1)
    if (!func(1, 2))
        if (!func(1, 2))
            if (!func(1, 2))
                return (0);

Before this fix, Betty only accounted for 1 level of single-line scope. It now handles nested single-line scopes.