Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: add to check spacing before typedef name (#462)" #463

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions norminette/norm_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"TOO_MANY_TABS_TD": "extra tabs before typedef name",
"MISSING_TAB_FUNC": "missing tab before function name",
"MISSING_TAB_VAR": "missing tab before variable name",
"MISSING_TAB_TYPDEF": "Missing tab before typedef name",
"TOO_MANY_TAB_VAR": "extra tab before variable name",
"LINE_TOO_LONG": "line too long",
"EXP_PARENTHESIS": "Expected parenthesis",
Expand Down Expand Up @@ -54,7 +53,6 @@
"ENUM_TYPE_NAMING": "Enum name must start with e_",
"UNION_TYPE_NAMING": "Union name must start with u_",
"GLOBAL_VAR_NAMING": "Global variable must start with g_",
"NO_TAB_BF_TYPEDEF": "Missing whitespace before typedef name",
"GLOBAL_VAR_DETECTED": "Global variable present in file. Make sure it is a reasonable choice.",
"EOL_OPERATOR": "Logic operator at the end of line",
"EMPTY_LINE_FUNCTION": "Empty line in function",
Expand Down
2 changes: 0 additions & 2 deletions norminette/rules/check_utype_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ def run(self, context):
name = ids[0][0]
loc = ids[check][1]
if is_td is True:
if not context.check_token(ids[check][1] - 1, ("SPACE", "TAB")):
context.new_error("NO_TAB_BF_TYPEDEF", ids[check][0])
if ids[check][0].value.startswith("t_") is False:
context.new_error("USER_DEFINED_TYPEDEF", context.peek_token(loc))
if utype is not None:
Expand Down
5 changes: 0 additions & 5 deletions tests/rules/samples/ko_struct_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ typedef struct toto {
enum g_toto vv;
} u_struct;

typedef struct test
{
int _42;
}t_boom;

int main(void)
{
return (0);
Expand Down
19 changes: 4 additions & 15 deletions tests/rules/samples/ko_struct_name.out
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,13 @@
<RBRACE> <TAB> <IDENTIFIER=u_struct> <SEMI_COLON> <NEWLINE>
ko_struct_name.c - IsEmptyLine In "GlobalScope" from "None" line 11":
<NEWLINE>
ko_struct_name.c - IsUserDefinedType In "GlobalScope" from "None" line 12":
<TYPEDEF> <SPACE> <STRUCT> <SPACE> <IDENTIFIER=test> <NEWLINE>
ko_struct_name.c - IsBlockStart In "UserDefinedType" from "GlobalScope" line 13":
<LBRACE> <NEWLINE>
ko_struct_name.c - IsVarDeclaration In "UserDefinedType" from "GlobalScope" line 14":
<TAB> <INT> <TAB> <IDENTIFIER=_42> <SEMI_COLON> <NEWLINE>
ko_struct_name.c - IsBlockEnd In "UserDefinedType" from "GlobalScope" line 15":
<RBRACE> <IDENTIFIER=t_boom> <SEMI_COLON> <NEWLINE>
ko_struct_name.c - IsEmptyLine In "GlobalScope" from "None" line 16":
<NEWLINE>
ko_struct_name.c - IsFuncDeclaration In "GlobalScope" from "None" line 17":
ko_struct_name.c - IsFuncDeclaration In "GlobalScope" from "None" line 12":
<INT> <TAB> <IDENTIFIER=main> <LPARENTHESIS> <VOID> <RPARENTHESIS> <NEWLINE>
ko_struct_name.c - IsBlockStart In "Function" from "GlobalScope" line 18":
ko_struct_name.c - IsBlockStart In "Function" from "GlobalScope" line 13":
<LBRACE> <NEWLINE>
ko_struct_name.c - IsExpressionStatement In "Function" from "GlobalScope" line 19":
ko_struct_name.c - IsExpressionStatement In "Function" from "GlobalScope" line 14":
<TAB> <RETURN> <SPACE> <LPARENTHESIS> <CONSTANT=0> <RPARENTHESIS> <SEMI_COLON> <NEWLINE>
ko_struct_name.c - IsBlockEnd In "Function" from "GlobalScope" line 20":
ko_struct_name.c - IsBlockEnd In "Function" from "GlobalScope" line 15":
<RBRACE> <NEWLINE>
ko_struct_name.c: Error!
Error: FORBIDDEN_TYPEDEF (line: 1, col: 1): Typedef declaration are not allowed in .c files
Expand All @@ -50,4 +40,3 @@ Error: FORBIDDEN_TYPEDEF (line: 5, col: 1): Typedef declaration are not a
Error: BRACE_NEWLINE (line: 5, col: 21): Expected newline before brace
Error: USER_DEFINED_TYPEDEF (line: 8, col: 25): User defined typedef must start with t_
Error: USER_DEFINED_TYPEDEF (line: 10, col: 5): User defined typedef must start with t_
Error: NO_TAB_BF_TYPEDEF (line: 15, col: 2): Missing whitespace before typedef name
Loading