NormEZ
Coding-style checker for Epitech students. This program analyzes your C source files for Epitech coding-style violations.
Install / Use
/learn @ronanboiteau/NormEZREADME
<img alt="NormEZ logo" src="/artwork/normez-logo.png" width="400px"/>
Coding-style checker for Epitech students. This program analyzes your C and Haskell source files for [Epitech C coding-style] and [Epitech Haskell coding-style] violations.
[French] Moulinette de norme pour les étudiants d'Epitech. Cette norminette cherche des erreurs de [norme C Epitech][Epitech C coding-style] et de [norme Haskell Epitech][Epitech Haskell coding-style] dans vos fichers de code source C et Haskell.
Table of contents
Getting started
Requirements
Installing Ruby on Fedora (Epitech's 2017 dump)
sudo dnf install ruby
How to use NormEZ?
- Clone the repository:
git clone https://github.com/ronanboiteau/NormEZ - Run
make installto install NormEZ ormake uninstallto uninstall it - Run NormEZ:
normez - NormEZ will recursively search for
.cand.hfiles to analyze in your current directory. - You can also pass specific files to check as argument:
normez src/*.c src/*.h
Options
-uor--no-update: don't check for NormEZ updates-for--ignore-files: ignore forbidden files-mor--ignore-functions: ignore forbidden functions-ior--ignore-all: ignore forbidden files & forbidden functions (same as-fm)-cor--colorless: disable all styling on output
Features
Coding-style violations checked by NormEZ.
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> = major infraction<br/> <img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> = minor infraction<br/>
C
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Lines with too many columns (> 80).<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Forbidden files: every regular file that does not match Makefile, *.c or *.h (ex: *.o, *.gch, bsq, ...) & that is not mentioned in a .gitignore file located in your current working directory.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> [Not exhaustive] Too broad filenames (ex: string.c, algo.c, my_algorithm.c, ...).<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Missing or corrupted header in sources files (.c), headers (.h) & Makefiles.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Functions that contain more than 20 lines.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Several semicolon-separated assignments on the same line.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> [Not exhaustive] Forbidden functions (printf(), dprintf(), atoi(), memcpy(), scanf(), strlen()...).<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Trailing space(s) and/or tabulation(s) at the end of a line.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Filenames that don't respect the [snake_case] naming convention.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Condition and assignment on the same line.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Directory names that don't respect the [snake_case] naming convention.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Too many functions in file (> 5).<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Functions with no parameters that don't take void as argument in their declaration.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Functions with too many arguments (> 4).<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Space(s) in indentation.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Missing space after keyword.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Misplaced pointer symbol(s).<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Macros used for constants.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Macros containing multiple assignments.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Too many else if statements.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Misplaced comments.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Missing space after comma.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Missing space around binary or ternary operator (=, ==, !=, <=, >=, &&, ||, +=, -=, *=, /=, %=, &=, ^=, |=, |, ^, >>, <<, >>=, <<=).<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Extra space after unary operators (!, sizeof, ++, --).<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Forbidden keyword (goto).<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Functions must be separated by one and only one empty line in .c files.<br/>
Haskell
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Lines with too many columns (> 80).<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Functions that contain more than 10 lines.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Filenames that don't respect the UpperCamelCase naming convention.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Imbedded if blocks.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Mutable variables used.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Missing type signatures.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Useless do.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> [Not exhaustive] Guards that should be pattern matching.<br/>
To-do
Coding-style violations NOT YET checked by NormEZ.
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> = major infraction<br/> <img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> = minor infraction<br/>
C
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Typedef not ending with _t.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Identifiers that don't respect the [snake_case] naming convention.<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Macros, global constants or enums that don't respect the SNAKE_CASE convention (uppercase [snake_case]).<br/>
<img alt="Major infraction" src="/artwork/direction_arrow_red_up.png" width="12" height="12"/> Function prototypes, typedefs, global variables, macros or static inline functions in .c source files.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Single-letter identifiers shouldn't be named l (lowercase L) or o to avoid confusions.</br>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Nested conditonal branchings (depth > 2).<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Header files not protected against double inclusion<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Wrong indentation level in .c and .h files.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Wrong indentation level in pre-processor directives.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Extra space between function name and opening parenthesis.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Misplaced curly brackets.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="12" height="12"/> Multiple variables declared on the same line.<br/>
<img alt="Minor infraction" src="/artwork/direction_arrow_green_down.png" width="1
