Skip to main content

Rubrics

A rubric defines how student code is evaluated in an assignment or challenge.

Why rubrics exist

Programming assignments are rarely judged by only one factor.

A good solution should consider multiple aspects such as:

  • Correctness
  • Code quality
  • Complexity
  • Security
  • Performance

Rubrics allow professors to combine all these aspects into a structured evaluation model. This makes grading more transparent, consistent, and focused on learning.

How rubrics work (high-level)

A rubric is composed of:

Assignment / Challenge
└── Rubrics (weighted)
└── Tests (weighted)
└── Score
  1. A piece of content (assignment or challenge) contains one or more rubrics.
  2. Each rubric contains one or more tests and a weight.
  3. Each test produces a score between 0 and 1.
  4. Scores are combined using weights to produce the final grade.

Rubric structure

Each rubric contains:

FieldDescription
TitleShort name of the evaluation criterion
DescriptionExplanation of what students should aim for
WeightHow much this rubric contributes to the final grade
TestsThe automated checks that evaluate this rubric

Rubric weights and grading

Rubrics determine how much each aspect contributes to the final score. A student’s final grade is calculated as the weighted sum of rubric scores. The sum of all rubric weights must equal 100%.

Example:

RubricWeightScore
Correctness50%100%
Code Quality20%80%
Complexity15%90%
Security15%70%
Final Grade90%
Final Grade = (0.5 * 1.0) + (0.2 * 0.8) + (0.15 * 0.9) + (0.15 * 0.7) = 0.9 (90%)

Tests inside rubrics

Rubrics do not directly evaluate code. Instead, they contain tests that automatically check specific conditions. The rubric score is calculated from the combined score of its tests.

Examples of tests:

  • Output matches expected result
  • Unit test passed
  • Cyclomatic complexity within range
  • No critical vulnerabilities detected

Each test has its own weight inside the rubric, controlling how much it contributes to the rubric score.

Example rubric

  • Title: Apply good coding practices
  • Description: Keep functions small, follow code style conventions and avoid security issues.
  • Weight: 100%

Tests inside the rubric:

TestMetricRangeTypeWeight
Complexity TestAverage Lines of Code per Function5–50Lower30%
Security TestNumber of vulnerabilities0-3Lower30%
Unit Testmy_unit_testN/AN/A40%

This rubric evaluates 3 aspects with custom weights.

  1. Whether students keep their functions concise and readable.
    • Students must have 5 or fewer lines of code on average, to get the full score. Having more than 50 lines of code per function will result in a score of 0.
  2. Whether they avoid security issues in their code
    • Students must have 0 vulnerabilities to get the full score. Having 3 or more vulnerabilities will result in a score of 0.
  3. Whether they pass a specific unit test
    • Students must pass the unit test to get the full score. Failing the test will result in a score of 0.

The final score of the rubric is calculated as the weighted sum of the test scores.

Rubric Score = (0.3 * Complexity Score) + (0.3 * Security Score) + (0.4 * Unit Test Score)