Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Comments #94

Open
Zacharyprime opened this issue Mar 3, 2021 · 1 comment
Open

Add Comments #94

Zacharyprime opened this issue Mar 3, 2021 · 1 comment

Comments

@Zacharyprime
Copy link
Member

This may be a mute point if we end up replacing Harrogate with a typescript implementation or other.

But Harrogate's code is a huge pain to read through because often it is not well spaced and has no real comments explaining anything. Even though a person who is accustomed to the language CAN decipher it, it gets very redundant having to re-decipher the code every time we make a change.

If harrogate is going to be continued in use, it would be worth development time to add comments, simplify things, and clean up general formatting. Maybe we should add a Project Clean Up Crew like we are doing (as of writing this) with botui.

For example, the only comment here is a bug report. I actually have yet to find a file that has more than 2 comments on it.

start_program = function() {
  if ((running != null ? running.resource : void 0) != null) {
    // TODO: change me!!
    // Create data directory
    running.resource.data_directory.create()["finally"](function() {
      var env;
      namespace.emit(events.starting.id, running.resource.name);
      env = Object.create(process.env);
      env.PYTHONPATH = "/usr/lib";
      running_process = spawn(running.resource.binary.path, [], {
        cwd: Path.resolve(running.resource.data_directory.path),
        env: env
      });
      running_process.on('error', function(data) {
        console.log("Could not spawn " + running.resource.binary.path + "!! Error details: " + (JSON.stringify({
          error: data
        })));
        namespace.emit(events.stderr.id, "Program crashed!\n\nError details:\n" + (JSON.stringify({
          error: data
        }, null, '\t')));
        namespace.emit(events.ended.id);
        stop_program();
      });
      running_process.stdout.on('data', function(data) {
        namespace.emit(events.stdout.id, data.toString('utf8'));
      });
      running_process.stderr.on('data', function(data) {
        namespace.emit(events.stderr.id, data.toString('utf8'));
      });
      return running_process.on('exit', function(code) {
        namespace.emit(events.stdout.id, "Program exited with code " + code);
        namespace.emit(events.ended.id);
        stop_program();
      });
    });
  }
};
@Zacharyprime
Copy link
Member Author

Braden informed me that harrogate was generated using coffee script, which is why there are no comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant