42School / norminette

Official 42 norminette
MIT License
926 stars 138 forks source link

Unexpected "Invalid file argument for #include directive" #470

Closed harsssh closed 7 months ago

harsssh commented 8 months ago

Describe the bug The error message "Invalid file argument for #include directive" occurs in code that includes float.h.

Erroneous code

#include <float.h>

int main(void)
{
    return (0);
}
$ norminette main.c
main.c: Error!
    Invalid file argument for #include directive

Additional infos

Additional context The error also occurs when the header name contains a type name, as in the case of #include <int>.

NiumXp commented 8 months ago

This is a TODO marked in the code: https://github.com/42School/norminette/blob/7de5543e6e7b5f558d2ee5d1189a3d9c139621f2/norminette/rules/is_preprocessor_statement.py#L205

To fix it you can just put "FLOAT" and "INT" in the following tuple: https://github.com/42School/norminette/blob/7de5543e6e7b5f558d2ee5d1189a3d9c139621f2/norminette/rules/is_preprocessor_statement.py#L41-L48