Create a Flake8 Test

Check your students' python code with the flake8 style guide.

Teaching students about the importance of coding best-practices in terms of stylization, documentation and redundancy can be difficult to do when the the code is checked manually. Using a linter makes that task much simpler for you and better for the student as they get instant context-specific, feedback on their code.

Linting your students' Python code is easy in AutoTest v2 with the use of the Flake8 block. It comes with flake8's default configuration so there's no need to set up your own config file. Just specify the name of the file to be checked and your students' will get comments automatically placed on their submission in the code viewer.

How to add the flake8 block to your configuration:

  1. Navigate to the Tests portion of the AutoTest settings.

  2. Click the Flake8 block to add it to the bottom of your AutoTest configuration or drag-and-drop it to the desired location.

  3. Select the version of the Flake8 style guide with which you would like to check your students' code using the drop down menu on the Flake8 block.

  4. Adjust the percentage grade deduction for comments of each severity level.

  5. Adjust the configuration file of Flake8 in the Config field.

  6. Finally, specify the file which is to be checked by Flake8 in the Student File field.

For more information about configuring Flake8 to your preferences, please refer to Flake8's documentation:

Last updated