Skip to content

Add Comments  #94

@Zacharyprime

Description

@Zacharyprime

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();
      });
    });
  }
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions