Spaces:
Running
Running
Upload server/code_review_environment.py with huggingface_hub
Browse files
server/code_review_environment.py
CHANGED
|
@@ -113,6 +113,50 @@ TASKS = {
|
|
| 113 |
"severity": "high"
|
| 114 |
},
|
| 115 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
"hard": [
|
| 117 |
{
|
| 118 |
"code": "def divide(a, b):\n return a / b",
|
|
|
|
| 113 |
"severity": "high"
|
| 114 |
},
|
| 115 |
],
|
| 116 |
+
"javascript": [
|
| 117 |
+
{
|
| 118 |
+
"code": "function add(a, b) {\n return a + b\n}\nconsole.log(add(1, 2))",
|
| 119 |
+
"language": "javascript",
|
| 120 |
+
"description": "Find code quality issues in JavaScript",
|
| 121 |
+
"has_syntax_error": False,
|
| 122 |
+
"expected_issues": ["missing semicolons"],
|
| 123 |
+
"severity": "low"
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"code": "var password = 'admin123';\nif (userInput == password) {\n grantAccess();\n}",
|
| 127 |
+
"language": "javascript",
|
| 128 |
+
"description": "Full review: find security issues",
|
| 129 |
+
"has_syntax_error": False,
|
| 130 |
+
"expected_issues": ["hardcoded password", "use === instead of ==", "security risk"],
|
| 131 |
+
"severity": "high"
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"code": "function getUserData(id) {\n var query = 'SELECT * FROM users WHERE id=' + id;\n return db.execute(query);\n}",
|
| 135 |
+
"language": "javascript",
|
| 136 |
+
"description": "Full review: find security issues",
|
| 137 |
+
"has_syntax_error": False,
|
| 138 |
+
"expected_issues": ["SQL injection", "no input validation", "security risk"],
|
| 139 |
+
"severity": "high"
|
| 140 |
+
},
|
| 141 |
+
],
|
| 142 |
+
"java": [
|
| 143 |
+
{
|
| 144 |
+
"code": "public class Main {\n public static void main(String[] args) {\n String s = null;\n System.out.println(s.length());\n }\n}",
|
| 145 |
+
"language": "java",
|
| 146 |
+
"description": "Full review: find bugs and security issues",
|
| 147 |
+
"has_syntax_error": False,
|
| 148 |
+
"expected_issues": ["null pointer exception", "no null check"],
|
| 149 |
+
"severity": "high"
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"code": "public void readFile(String path) {\n FileReader f = new FileReader(path);\n f.read();\n}",
|
| 153 |
+
"language": "java",
|
| 154 |
+
"description": "Full review: find bugs and security issues",
|
| 155 |
+
"has_syntax_error": False,
|
| 156 |
+
"expected_issues": ["resource not closed", "no exception handling"],
|
| 157 |
+
"severity": "medium"
|
| 158 |
+
},
|
| 159 |
+
],
|
| 160 |
"hard": [
|
| 161 |
{
|
| 162 |
"code": "def divide(a, b):\n return a / b",
|