eisen-dev/eisen_front

View on GitHub
webd/ts/libs/Promise.ts

Summary

Maintainability
D
3 days
Test Coverage

Showing 10 of 10 total issues

File Promise.ts has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
 
/**
Module P: Generic Promises for TypeScript
 
 
Severity: Minor
Found in webd/ts/libs/Promise.ts - About 3 hrs to fix

    Function unfoldCore has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function unfoldCore<Seed, Element>(
    elements: Element[],
    deferred: Deferred<Element[]>,
    unspool: (current: Seed) => { promise: Promise<Element>; next?: Seed },
    seed: Seed): void
    Severity: Minor
    Found in webd/ts/libs/Promise.ts - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      fail(f: (err: Rejection) => void ): Deferred<Value>
      {
      if (this.status === Status.Rejected) {
      f(this._error);
      return this;
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 4 hrs to fix
      webd/ts/libs/Promise.ts on lines 330..344

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      done(f: (v: Value) => void ): Deferred<Value>
      {
      if (this.status === Status.Resolved) {
      f(this._result);
      return this;
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 4 hrs to fix
      webd/ts/libs/Promise.ts on lines 346..360

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      reject(err: Rejection) {
      if (this._status !== Status.Unfulfilled)
      throw new Error("tried to reject a fulfilled promise");
       
      this._error = err;
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 2 hrs to fix
      webd/ts/libs/Promise.ts on lines 371..381

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      resolve(result: Value) {
      if (this._status !== Status.Unfulfilled)
      throw new Error("tried to resolve a fulfilled promise");
       
      this._result = result;
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 2 hrs to fix
      webd/ts/libs/Promise.ts on lines 383..393

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function resolve<Value>(v: Value): Promise<Value>
      {
      return defer<Value>().resolve(v).promise();
      }
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 1 hr to fix
      webd/ts/libs/Promise.ts on lines 33..36

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function reject<Value>(err: Rejection): Promise<Value>
      {
      return defer<Value>().reject(err).promise();
      }
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 1 hr to fix
      webd/ts/libs/Promise.ts on lines 24..27

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      fail(f: (err: Rejection) => void ): Promise<Value> {
      this.deferred.fail(f);
      return this;
      }
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 1 hr to fix
      webd/ts/libs/Promise.ts on lines 244..247

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      done(f: (v: Value) => void ): Promise<Value> {
      this.deferred.done(f);
      return this;
      }
      Severity: Major
      Found in webd/ts/libs/Promise.ts and 1 other location - About 1 hr to fix
      webd/ts/libs/Promise.ts on lines 249..252

      There are no issues that match your filters.

      Category
      Status