ai-code-review-env / env /tasks.py
YAXH64
fix: docker build issue
a2ae9c3
Raw
History Blame Contribute Delete
2.72 kB
"""
Task definitions for the Code Review environment.
3 tasks with progressive difficulty: easy β†’ medium β†’ hard
Each task covers a distinct bug category: syntax, logic, performance.
"""
TASKS = [
{
"id": 1,
"difficulty": "easy",
"language": "javascript",
"category": "syntax",
"title": "Missing Closing Parenthesis",
"description": (
"This function has a syntax error in its parameter list. "
"It will throw a SyntaxError and cannot be parsed by any JS engine."
),
"code": (
"function add(a, b {\n"
" return a + b;\n"
"}"
),
# Agent must mention at least one of these in its identify response
"identify_keywords": [
"parenthesis", "paren", "syntax", "missing", "closing", "parameter", "("
],
# Exact expected fix β€” normalized during grading
"fixed_code": (
"function add(a, b) {\n"
" return a + b;\n"
"}"
),
},
{
"id": 2,
"difficulty": "medium",
"language": "javascript",
"category": "logic",
"title": "Wrong Even/Odd Condition",
"description": (
"This function claims to check if a number is even, but the condition "
"is inverted β€” it returns true for odd numbers instead."
),
"code": (
"function isEven(n) {\n"
" return n % 2 === 1;\n"
"}"
),
"identify_keywords": [
"logic", "wrong", "condition", "odd", "even",
"remainder", "modulo", "===", "inverted", "incorrect"
],
"fixed_code": (
"function isEven(n) {\n"
" return n % 2 === 0;\n"
"}"
),
},
{
"id": 3,
"difficulty": "hard",
"language": "javascript",
"category": "performance",
"title": "Inefficient Array Iteration",
"description": (
"This loop re-evaluates arr.length on every iteration and uses verbose "
"index-based access. A modern functional approach is cleaner and avoids "
"repeated property lookups."
),
"code": (
"for (let i = 0; i < arr.length; i++) {\n"
" console.log(arr[i]);\n"
"}"
),
"identify_keywords": [
"performance", "optimize", "foreach", "for...of", "functional",
"length", "iteration", "inefficient", "modern", "repeated", "lookup"
],
"fixed_code": (
"arr.forEach(item => {\n"
" console.log(item);\n"
"});"
),
},
]