Code Quality
The Code Quality test runs a linter or other program that produces feedback on the code, which is stored and displayed inline in the student’s code.
Code Quality tests provide integration with existing linters, but you can also provide your own code analysis tool that produces feedback programatically. The generated feedback is accessible in the Code Viewer by moving your cursor over the line numbers with comments, as well as in the AutoTest output.
The resulting score of this test is determined by the amount of comments that were produced by the linter. Each comment has a severity, which is determined by the linter, and for each different severity level you can configure an amount of points to be subtracted from the score.
There are four severity levels: fatal, error, warning, and info.
The final score is the score left over from subtracting the penalty of each comment from the initial score of 100, interpreted as a percentage, multiplied by the weight of the step.

Compatibility scripts

A list of built in linters are available by default. Custom linters can also be installed and used. Some linters require arguments, that can be given via the UI as well.
For most linters it is necessary to transform their output to a format CodeGrade can understand. This is quite the tricky business, so CodeGrade provides integration for a couple of popular linters out of the box! For the linters that are already supported, refer to the table below.
If your favourite linter is not in the list, please send us an email at [email protected] so we can discuss how we can add support for it!

Supported static code analysis tools

Linter
Language(s)
Checkstyle
Java
Clang-Tidy
C, C++
ESLint
JavaScript
Flake8
Python
PMD
Java
PyLint
Python
Resharper
C#

Use cases

The Code Quality test is useful when you want students to learn to adhere to a style guide, but also when you want to warn your students about common pitfalls in the language and/or framework you are using.
Last modified 5mo ago
Copy link