Definition Files
In Code FREAK, assignments and tasks can be defined YAML files. This includes the configuration of automated evaluation.
1. Assignment
An assignment is defined by a directory (or packaged archive) containing a codefreak.yml
with the following schema.
Field Name | Type | Description |
---|---|---|
title |
|
REQUIRED. The name of the assignment. |
tasks |
|
List of paths to task definitions (relative to the assignment). |
title: My Assignment
tasks:
- my-task-1
- my-task-2
├─ codefreak.yml ├─ my-task-1 │ ├─ codefreak.yml │ ├─ main.c ├─ my-task-2 │ ├─ codefreak.yml │ ├─ ... ├─ ...
2. Task
A task is defined by a directory (or packaged archive) containing source code files and a codefreak.yml
with the following schema. The codefreak.yml
will be excluded from the source code files.
Field Name | Type | Description |
---|---|---|
title |
|
REQUIRED. The name of the task. |
description |
|
Detailed instructions for students. Basic markdown is supported. |
hidden |
[ |
Patterns of files that should be hidden from students. Matching files are only included for evaluation. If matching files are created by students, they are ignored for evaluation. |
protected |
[ |
Patterns of files that should be read-only. Students will be able to see matching files but modifications are ignored for evaluation. Non-existent files can be protected to prevent their creation. |
evaluation |
List of automatic evaluation steps. |
File patterns use the Ant pattern syntax. For more information refer to the official documentation. |
title: My Task
description: Write a function `add(int a, int b)` that returns the sum of `a` and `b`
hidden:
- src/test/**
- .codeclimate.yml
protected:
- build.gradle
- settings.gradle
evaluation:
- step: codeclimate
- step: junit
3. Evaluation
Automatic evaluation consists one or more steps. Each step is implemented by a so-called runner. Runners take the student submissions and execute e.g. static code analysis. They then collect the results to give feedback to the student and support the teacher’s grading. The same runner can be used in multiple steps (usually with different configuration). An evaluation step is defined as follows.
Field Name | Type | Description |
---|---|---|
step |
|
REQUIRED. The name of the runner. See below for supported ones. |
title |
|
An optional human readable name for the evaluation step. Summarize briefly for your students what this evaluation step checks (e.g. "Test functions.py", "Class XYZ Tests", "Code Style", …). The default title depends on the runner. |
timeout |
|
An optional custom timeout in seconds after which the evaluation step will be canceled and marked as failed. There is a system-wide default timeout of 5min. |
options |
Map[ |
Runner-specific configuration. See below for details. |
3.1. Command Line Runner
Name: commandline
This is the most basic runner. It executes arbitrary commands and uses the output as feedback. The evaluation result is based on exit codes of the commands.
Key | Type | Description |
---|---|---|
image |
|
REQUIRED. The name of the Docker image in which the commands are run. |
project-path |
|
REQUIRED. Absolute path of where the student submission is placed. |
commands |
[ |
List of commands that executed. Working directory is the |
stop-on-fail |
|
Whether to stop when the first command fails or always execute all commands. Default is |
evaluation:
- step: commandline
options:
image: gradle
project-path: /home/gradle/project
commands:
- pwd
- gradle test
- ls build/test-results/test
3.2. Code Climate Runner
Name: codeclimate
This runner performs static code analysis via Code Climate. It is configured by including a .codeclimate.yml
in the task files. See official documentation for details.
evaluation:
- step: codeclimate
plugins:
sonar-java:
enabled: true
3.3. JUnit Runner
Name: junit
This runner executes unit tests in Java projects via JUnit. It is pre-configured to work with standard Gradle projects.
Key | Type | Description |
---|---|---|
image |
|
Inherited from Command Line Runner. Default is |
project-path |
|
Inherited from Command Line Runner. Default is |
commands |
[ |
Inherited from Command Line Runner. Default is |
stop-on-fail |
|
Inherited from Command Line Runner. Default is |
evaluation:
- step: junit