Skip to content

Commit

Permalink
Removed redundant code lines
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentBlanckaert committed Nov 22, 2024
1 parent a7acf7d commit 60146bb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 39 deletions.
25 changes: 7 additions & 18 deletions tested/languages/javascript/templates/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,13 @@ function sendException(stream, exception) {
"type": exception.constructor.name
}));
} else {
// Temporarily allow objects with "message" and "name".
// TODO: remove this once the semester is over
// noinspection PointlessBooleanExpressionJS
if (typeof exception === 'object') {
fs.writeSync(stream, JSON.stringify({
"message": exception.message ?? "",
"stacktrace": "",
"type": exception.name ?? ""
}));
} else {
// We have something else, so we cannot rely on stuff being present.
fs.writeSync(stream, JSON.stringify({
"message": JSON.stringify(exception),
"stacktrace": "",
"type": exception.constructor.name ?? (Object.prototype.toString.call(exception)),
"additional_message_keys": ["languages.javascript.runtime.invalid.exception"]
}));
}
// We have something else, so we cannot rely on stuff being present.
fs.writeSync(stream, JSON.stringify({
"message": JSON.stringify(exception),
"stacktrace": "",
"type": exception.constructor.name ?? (Object.prototype.toString.call(exception)),
"additional_message_keys": ["languages.javascript.runtime.invalid.exception"]
}));
}
}

Expand Down
3 changes: 0 additions & 3 deletions tested/languages/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ def compilation(self, files: list[str]) -> CallbackResult:
:param files: A suggestion containing the dependencies TESTed thinks might
be useful to compile. By convention, the last file in the list
is the file containing the "main" function.
:param directory: The directory in which these files can be found.
:return: The compilation command and either the resulting files or a filter
for the resulting files.
"""
Expand Down
1 change: 0 additions & 1 deletion tested/languages/typescript/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def run_eslint(
str(submission.absolute()),
],
)
logger.warning(f"ESLint produced {execution_results}")

if execution_results is None:
return [], []
Expand Down
23 changes: 6 additions & 17 deletions tested/languages/typescript/templates/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,13 @@ function sendException(stream: number, exception: Error | Object | {constructor:
}));
} else {
// Comes out of the values.js:
// Temporarily allow objects with "message" and "name".
// TODO: remove this once the semester is over
// noinspection PointlessBooleanExpressionJS
if (typeof exception === 'object') {
fs.writeSync(stream, JSON.stringify({
"message": (exception as Error).message ?? "",
"stacktrace": "",
"type": (exception as Error).name ?? ""
}));
} else {
// We have something else, so we cannot rely on stuff being present.
fs.writeSync(stream, JSON.stringify({
"message": JSON.stringify(exception),
"stacktrace": "",
"type": (exception as Object).constructor.name ?? (Object.prototype.toString.call(exception)),
"additional_message_keys": ["languages.typescript.runtime.invalid.exception"]
}));
}
fs.writeSync(stream, JSON.stringify({
"message": JSON.stringify(exception),
"stacktrace": "",
"type": (exception as Object).constructor.name ?? (Object.prototype.toString.call(exception)),
"additional_message_keys": ["languages.typescript.runtime.invalid.exception"]
}));
}
}

Expand Down

0 comments on commit 60146bb

Please sign in to comment.