dawnbeen / c_formatter_42

C language formatter for 42 norminette
GNU General Public License v3.0
176 stars 17 forks source link

Bad indentation #54

Closed MathieuSoysal closed 1 year ago

MathieuSoysal commented 1 year ago

Introduction

When we execute norminette with this file:

int main(void)
{
    char    *output;

    output = malloc(sizeof(int) * 8);
    for (int i = 0; i < 20; ++i)
    {
        sprintf(output, "%d", i);
        sprintf(output, "%s",
            is_fizz(i) ? (is_fizzbuzz(i) ? "FizzBuzz" : "Fizz") : (is_buzz(i) ? "Buzz" : output));
        printf("%s\n", output);
    }
    free(output);
    return (0);
}

It doesn't warn about the indentation.

Problem

When we use the formatter a new tab is added:

int main(void)
{
    char    *output;

    output = malloc(sizeof(int) * 8);
    for (int i = 0; i < 20; ++i)
    {
        sprintf(output, "%d", i);
        sprintf(output, "%s",
                is_fizz(i) ? (is_fizzbuzz(i) ? "FizzBuzz" : "Fizz") : (is_buzz(i) ? "Buzz" : output));
        printf("%s\n", output);
    }
    free(output);
    return (0);
}

And now the norminette warm about the indentation on this line:

                is_fizz(i) ? (is_fizzbuzz(i) ? "FizzBuzz" : "Fizz") : (is_buzz(i) ? "Buzz" : output));
younesaassila commented 1 year ago

@cacharle This is related to the same bug I have already fixed in my PRs a month ago. Update still isn't on PyPI a month later. Any ETA?

keyhr commented 1 year ago

I've just applied updates to the PyPI packages.

younesaassila commented 1 year ago

@keyhr Thank you!

younesaassila commented 1 year ago

This issue should be closed since the fix has been published and no one reported encountering this issue afterwards.