Closed younesaassila closed 1 year ago
Is Norminette rules changed after I quit 42? or did I just missed the test case? Anyway, the code seems good.
I don't believe the rules changed recently. The bug was just well hidden thanks to the discount system for if
, while
, etc.
@cacharle You should reopen #51 (marked as duplicate of #50) because they are not relating to the same issue. #51 seems to be a conflict with clang-format where clang-format breaks the alignment of a correctly aligned file and c_formatter_42 fails to fix it after. I can reproduce the bug (both old and new versions) with this file of mine (for function are_rotations_same_direction
):
See: #53
Fixes #50 by properly calculating the additional indent level:
The previous code assumed a paren depth of 1 meant 2 tabs. This is incorrect and the code made a few exceptions for control statements and return statements to correct for this behavior. Of course, this couldn't catch all possible code where this adjustment was needed.
The new code assumes a paren depth of 1 means 1 tab. Tab count starts increasing once the paren depth is at least 2. (Had to check norminette's code to find this behavior, it wasn't fun)
Also fixed a test case that was based on the previous (incorrect) behavior (and it indeed made the norminette complain)
Finally, made a line of the code clearer and removed an unused comment at the top of the test file.