# Style Grading ## (White)spaces and newlines | Offense | Pts. deducted | | ------------------------------------------------------------ | ------------- | | Keyword spaces missing or inconsistent (spaces missing after `for`, `while`, `if`, `return` etc.) | -0.25 | | Wrong use of spaces around operators: All binary operators have between the operator and each operand (i.e. `a + b`). All unary operators have no space between operator and operand (`!a`). Exceptions: `,` (`a, b`), `.` (`a.b`) and `->` (`a->b`). | -0.25 | | Inconsistent use of spaces after type casting (i.e. `(int) x` vs `(int)x`) | -0.25 | | Trailing whitespace (> 2) | -0.25 | | Inconsistent or no use of white lines | -0.25 | | Inconsistent or bad use of brackets (i.e. no space/newline before `{`, mixing of spaces and newlines) | -0.25 | | `if` or `else` statements on a single line | -0.25 | ## Indentation Indentation is inconsistent if tabs and spaces are mixed, or if the number of spaces is inconsistent. | Offense | Pts. deducted | | ----------------------------------- | ------------- | | Indentation inconsistent (1 time) | -0.25 | | Indentation inconsistent (> 1 time) | -0.5 | ## Code length Max line length: 80 characters Max function length: 30 lines (excluding white lines, comments, single brackets) | Offense | Pts. deducted | | ------------------------- | ------------- | | Line too long (> 2 times) | -0.25 | | Function too long | -0.25 | ## Comments | Offense | Pts. deducted | | ------------------------------------------------------------ | ------------- | | Broken/mixed Dutch or English in comments | -0.25 | | No or minimal header comments | -0.25 | | Undocumented functions | -0.25 | | Some useless comments | -0.25 | | A lot of useless comments | -0.5 | | Left TODO's, commented code or unnecessary framework code (i.e. `/* SOME CODE MISSING */`) | -0.25 | ## Functions and variables | Offense | Pts. deducted | | ------------------------------------------------------------ | ------------- | | Some variable names and functions are bad (i.e. non-obvious abbreviations, vague names, `temp1`, `temp1` etc.) | -0.25 | | A lot variable names and functions are bad | -0.5 | | Bad or inconsistent use of naming conventions (i.e. alternating between `snake_case` and `camelCase`, using upper case for non-constants, etc.) | -0.25 | | Use of unnecessary global variables | -0.5 | ## Code | Offense | Pts. deducted | | ------------------------------------------------------------ | ------------- | | Some inefficient or non-DRY code (i.e. unnecessary loops, no or minimal use of functions, duplicate code, etc.) | -0.25 | | A lot of inefficient or non-DRY code | -1 | | Unidiomatic code (i.e. `(*a).b` instead of `a->b`, `*(a + 46)` instead of `a[46]`, etc.) | -0.25 | | Code contains non-printable ASCII characters | -0.25 |