Using the TypeScript compiler to fix erroneous Node.js snippets
Most online code snippets do not run. This means that developers looking to reuse code from online sources must manually find and fix errors. We present an approach for automatically evaluating and correcting errors in Node.js code snippets: Node Code Correction (NCC). NCC leverages the ability of t...
Saved in:
Main Authors: | , , |
---|---|
Format: | text |
Language: | English |
Published: |
Institutional Knowledge at Singapore Management University
2023
|
Subjects: | |
Online Access: | https://ink.library.smu.edu.sg/sis_research/8881 https://ink.library.smu.edu.sg/context/sis_research/article/9884/viewcontent/scam.pdf |
Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
Institution: | Singapore Management University |
Language: | English |
id |
sg-smu-ink.sis_research-9884 |
---|---|
record_format |
dspace |
spelling |
sg-smu-ink.sis_research-98842024-06-13T08:54:40Z Using the TypeScript compiler to fix erroneous Node.js snippets REID, Brittany TREUDE, Christoph WAGNER, Markus Most online code snippets do not run. This means that developers looking to reuse code from online sources must manually find and fix errors. We present an approach for automatically evaluating and correcting errors in Node.js code snippets: Node Code Correction (NCC). NCC leverages the ability of the TypeScript compiler to generate errors and inform code corrections through the combination of TypeScript’s builtin codefixes, our own targeted fixes, and deletion of erroneous lines. Compared to existing approaches using linters, our findings suggest that NCC is capable of detecting a larger number of errors per snippet and more error types, and it is more efficient at fixing snippets. We find that 73.7% of the code snippets in NPM documentation have errors; with the use of NCC’s corrections, this number was reduced to 25.1%. Our evaluation confirms that the use of the TypeScript compiler to inform code corrections is a promising strategy to aid in the reuse of code snippets from online sources. 2023-10-01T07:00:00Z text application/pdf https://ink.library.smu.edu.sg/sis_research/8881 info:doi/10.1109/SCAM59687.2023.00031 https://ink.library.smu.edu.sg/context/sis_research/article/9884/viewcontent/scam.pdf http://creativecommons.org/licenses/by-nc-nd/4.0/ Research Collection School Of Computing and Information Systems eng Institutional Knowledge at Singapore Management University Error Correction Node.js Static Analysis Programming Languages and Compilers Software Engineering |
institution |
Singapore Management University |
building |
SMU Libraries |
continent |
Asia |
country |
Singapore Singapore |
content_provider |
SMU Libraries |
collection |
InK@SMU |
language |
English |
topic |
Error Correction Node.js Static Analysis Programming Languages and Compilers Software Engineering |
spellingShingle |
Error Correction Node.js Static Analysis Programming Languages and Compilers Software Engineering REID, Brittany TREUDE, Christoph WAGNER, Markus Using the TypeScript compiler to fix erroneous Node.js snippets |
description |
Most online code snippets do not run. This means that developers looking to reuse code from online sources must manually find and fix errors. We present an approach for automatically evaluating and correcting errors in Node.js code snippets: Node Code Correction (NCC). NCC leverages the ability of the TypeScript compiler to generate errors and inform code corrections through the combination of TypeScript’s builtin codefixes, our own targeted fixes, and deletion of erroneous lines. Compared to existing approaches using linters, our findings suggest that NCC is capable of detecting a larger number of errors per snippet and more error types, and it is more efficient at fixing snippets. We find that 73.7% of the code snippets in NPM documentation have errors; with the use of NCC’s corrections, this number was reduced to 25.1%. Our evaluation confirms that the use of the TypeScript compiler to inform code corrections is a promising strategy to aid in the reuse of code snippets from online sources. |
format |
text |
author |
REID, Brittany TREUDE, Christoph WAGNER, Markus |
author_facet |
REID, Brittany TREUDE, Christoph WAGNER, Markus |
author_sort |
REID, Brittany |
title |
Using the TypeScript compiler to fix erroneous Node.js snippets |
title_short |
Using the TypeScript compiler to fix erroneous Node.js snippets |
title_full |
Using the TypeScript compiler to fix erroneous Node.js snippets |
title_fullStr |
Using the TypeScript compiler to fix erroneous Node.js snippets |
title_full_unstemmed |
Using the TypeScript compiler to fix erroneous Node.js snippets |
title_sort |
using the typescript compiler to fix erroneous node.js snippets |
publisher |
Institutional Knowledge at Singapore Management University |
publishDate |
2023 |
url |
https://ink.library.smu.edu.sg/sis_research/8881 https://ink.library.smu.edu.sg/context/sis_research/article/9884/viewcontent/scam.pdf |
_version_ |
1814047607750656000 |