dawnbeen / c_formatter_42

C language formatter for 42 norminette

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad indentation

MathieuSoysal opened this issue · comments

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));

@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?

commented

I've just applied updates to the PyPI packages.

@keyhr Thank you!

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