Closed ChiefOfGxBxL closed 6 years ago
Refactor the .write()
method to return an array of warnings and errors, and the buffer. A separate file will check for warnings and errors and handle them accordingly. The buffer will be written to a logical path. This will also help reduce the code repetition that Code Climate is reporting.
Get rid of the .write()
method and make the translator simply a function that returns an object:
{
warnings: [],
errors: [],
result: ...
}
This way the file system code is logically separated from the translation. Plus, translation may be desired and writing its result to a file may not. Translation and file system should really be decoupled.
Remove the }. Writing the files should be left to the implementing program.
.write()
method in each translator and simply return an object: { errors: [], result: