dawnbeen / c_formatter_42

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

Does not break line when line is too long in header #77

Open MathieuSoysal opened 7 months ago

MathieuSoysal commented 7 months ago

Introduction

In this file header file, the formatter does not break line when line is too long :

Current format

#ifndef DOUBLE_LINKED_LIST_ESSENTIALS_H
# define DOUBLE_LINKED_LIST_ESSENTIALS_H

# include "../double_linked_list/double_linked_list_essentials.h"
# include "../node.h"

/**
 * @brief The structure of a double linked list
 */
typedef struct double_linked_list
{
    t_node              *head;
    t_node              *tail;
    unsigned int        size;
}                       t_double_linked_list;

/**
 * @brief Create a new linked list, the linked list is LIFO (Last In First Out)
 * @return The new linked list
 */
t_double_linked_list    *double_linked_list_create(void);

/**
 * @brief Free the linked list and its content
 * @param obj The linked list to free
 * @param free_content The function to free the content of the linked list,
    can be NULL if the content is in stack
 */
void                    double_linked_list_free(t_double_linked_list *obj,
                            void (*free_content)(void *));

/**
 * @brief Remove head element from the linked list
 * @param obj The linked list to remove the last element
 * @param free_content The function to free the content of the linked list,
 * can be NULL if the content is in stack
 */
void                    double_linked_list_remove_head(t_double_linked_list *obj,
                            void (*free_content)(void *));

#endif // DOUBLE_LINKED_LIST_ESSENTIALS_H

Error line too long

image

Expected format

It should be :

#ifndef DOUBLE_LINKED_LIST_ESSENTIALS_H
# define DOUBLE_LINKED_LIST_ESSENTIALS_H

# include "../double_linked_list/double_linked_list_essentials.h"
# include "../node.h"

/**
 * @brief The structure of a double linked list
 */
typedef struct double_linked_list
{
    t_node              *head;
    t_node              *tail;
    unsigned int        size;
}                       t_double_linked_list;

/**
 * @brief Create a new linked list, the linked list is LIFO (Last In First Out)
 * @return The new linked list
 */
t_double_linked_list    *double_linked_list_create(void);

/**
 * @brief Free the linked list and its content
 * @param obj The linked list to free
 * @param free_content The function to free the content of the linked list,
    can be NULL if the content is in stack
 */
void                    double_linked_list_free(t_double_linked_list *obj,
                            void (*free_content)(void *));

/**
 * @brief Remove head element from the linked list
 * @param obj The linked list to remove the last element
 * @param free_content The function to free the content of the linked list,
 * can be NULL if the content is in stack
 */
void                    double_linked_list_remove_head(
                            t_double_linked_list *obj,
                            void (*free_content)(void *));

#endif // DOUBLE_LINKED_LIST_ESSENTIALS_H