Reactive-Extensions/RxJS

View on GitHub
src/core/expressions/compiler.ts

Summary

Maintainability
F
2 wks
Test Coverage

Showing 33 of 33 total issues

File compiler.ts has 966 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Expression {
nodeType: ExpressionType;
 
constructor(nodeType: ExpressionType) {
this.nodeType = nodeType;
Severity: Major
Found in src/core/expressions/compiler.ts - About 2 days to fix

    Expression has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Expression {
    nodeType: ExpressionType;
     
    constructor(nodeType: ExpressionType) {
    this.nodeType = nodeType;
    Severity: Minor
    Found in src/core/expressions/compiler.ts - About 4 hrs to fix

      Function visitBinary has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      visitBinary(node: BinaryExpression): Expression {
      this.visit(node.left);
      this.visit(node.right);
       
      var r = this._stack.pop();
      Severity: Major
      Found in src/core/expressions/compiler.ts - About 2 hrs to fix

        Function visitBinary has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        visitBinary(node: BinaryExpression): any {
        var i = "";
         
        switch (node.nodeType) {
        case ExpressionType.Add:
        Severity: Major
        Found in src/core/expressions/compiler.ts - About 2 hrs to fix

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

          switch (node.nodeType) {
          case ExpressionType.Add:
          i = "+";
          break;
          case ExpressionType.Subtract:
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 day to fix
          src/core/expressions/compiler.ts on lines 1114..1169

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

          switch (node.nodeType) {
          case ExpressionType.Add:
          i = "+";
          break;
          case ExpressionType.Subtract:
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 day to fix
          src/core/expressions/compiler.ts on lines 713..768

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

          class IndexExpression extends Expression {
          _expression: Expression;
          _args: Expression[];
           
          constructor(expression: Expression, args: Expression[]) {
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 day to fix
          src/core/expressions/compiler.ts on lines 461..494

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

          class InvocationExpression extends Expression {
          _expression: Expression;
          _args: Expression[];
           
          constructor(expression: Expression, args: Expression[]) {
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 day to fix
          src/core/expressions/compiler.ts on lines 537..570

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

          visitMany<T extends Expression>(nodes: T[]): T[] {
          var res = new Array<T>(nodes.length);
           
          for (var i = 0; i < nodes.length; i++) {
          var oldNode = nodes[i];
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 4 hrs to fix
          src/core/expressions/compiler.ts on lines 179..189

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

          visitMany<E extends Expression>(nodes: E[]): T[] {
          var res = new Array<T>(nodes.length);
           
          for (var i = 0; i < nodes.length; i++) {
          var oldNode = nodes[i];
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 4 hrs to fix
          src/core/expressions/compiler.ts on lines 244..254

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

          visitLambda<T extends Function>(node: LambdaExpression<T>): Expression {
          this._stack.push(node.parameters);
           
          this.visit(node.body);
           
           
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 2 hrs to fix
          src/core/expressions/compiler.ts on lines 951..959

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

          visitLambda<T extends Function>(node: LambdaExpression<T>): Expression {
          this._stack.push(node.parameters);
           
          this.visit(node.body);
           
           
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 2 hrs to fix
          src/core/expressions/compiler.ts on lines 1023..1031

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

          switch (node.nodeType) {
          case ExpressionType.Negate:
          i = "-";
          break;
          case ExpressionType.UnaryPlus:
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 1177..1190

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

          visitLambda<T extends Function>(node: LambdaExpression<T>): string {
          var body = this.visit(node.body);
          var children = this.visitMany(node.parameters);
          children.unshift(body);
          return "Lambda(" + children.join(", ") + ")";
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 1062..1067

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

          switch (node.nodeType) {
          case ExpressionType.Negate:
          i = "-";
          break;
          case ExpressionType.UnaryPlus:
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 684..697

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

          visitInvoke(node: InvocationExpression): string {
          var expression = this.visit(node.expression);
          var children = this.visitMany(node.args);
          children.unshift(expression);
          return "Invoke(" + children.join(", ") + ")";
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 1055..1060

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

          for (var i = this._stack.length - 1; i >= 0; i--) {
          if (this._stack[i].indexOf(node) >= 0) {
          found = true;
          break;
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 937..942

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

          for (var i = this._stack.length - 1; i >= 0; i--) {
          if (this._stack[i].indexOf(node) >= 0) {
          found = true;
          break;
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 1 other location - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 1009..1014

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

          visitCall(node: FunctionCallExpression): Expression {
          return node.update(this.visit(node.obj), this.visitMany(node.args));
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 3 other locations - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 208..210
          src/core/expressions/compiler.ts on lines 224..226
          src/core/expressions/compiler.ts on lines 240..242

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

          visitInvoke(node: InvocationExpression): Expression {
          return node.update(this.visit(node.expression), this.visitMany(node.args));
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 3 other locations - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 208..210
          src/core/expressions/compiler.ts on lines 228..230
          src/core/expressions/compiler.ts on lines 240..242

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

          visitBinary(node: BinaryExpression): Expression {
          return node.update(this.visit(node.left), this.visit(node.right));
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 3 other locations - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 224..226
          src/core/expressions/compiler.ts on lines 228..230
          src/core/expressions/compiler.ts on lines 240..242

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

          visitIndex(node: IndexExpression): Expression {
          return node.update(this.visit(node.obj), this.visitMany(node.args));
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 3 other locations - About 1 hr to fix
          src/core/expressions/compiler.ts on lines 208..210
          src/core/expressions/compiler.ts on lines 224..226
          src/core/expressions/compiler.ts on lines 228..230

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

          for (var i = 0; i < n; i++) {
          args[n - i - 1] = this._stack.pop();
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 4 other locations - About 55 mins to fix
          src/core/expressions/compiler.ts on lines 806..808
          src/core/expressions/compiler.ts on lines 852..854
          src/core/expressions/compiler.ts on lines 870..872
          src/core/expressions/compiler.ts on lines 906..908

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

          for (var i = 0; i < n; i++) {
          args[n - i - 1] = this._stack.pop();
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 4 other locations - About 55 mins to fix
          src/core/expressions/compiler.ts on lines 806..808
          src/core/expressions/compiler.ts on lines 825..827
          src/core/expressions/compiler.ts on lines 870..872
          src/core/expressions/compiler.ts on lines 906..908

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

          for (var i = 0; i < n; i++) {
          args[n - i - 1] = this._stack.pop();
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 4 other locations - About 55 mins to fix
          src/core/expressions/compiler.ts on lines 806..808
          src/core/expressions/compiler.ts on lines 825..827
          src/core/expressions/compiler.ts on lines 852..854
          src/core/expressions/compiler.ts on lines 870..872

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

          for (var i = 0; i < n; i++) {
          args[n - i - 1] = this._stack.pop();
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 4 other locations - About 55 mins to fix
          src/core/expressions/compiler.ts on lines 825..827
          src/core/expressions/compiler.ts on lines 852..854
          src/core/expressions/compiler.ts on lines 870..872
          src/core/expressions/compiler.ts on lines 906..908

          Identical blocks of code found in 5 locations. Consider refactoring.
          Open

          for (var i = 0; i < n; i++) {
          args[n - i - 1] = this._stack.pop();
          }
          Severity: Major
          Found in src/core/expressions/compiler.ts and 4 other locations - About 55 mins to fix
          src/core/expressions/compiler.ts on lines 806..808
          src/core/expressions/compiler.ts on lines 825..827
          src/core/expressions/compiler.ts on lines 852..854
          src/core/expressions/compiler.ts on lines 906..908

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

          if (node.obj !== null) {
          this.visit(node.obj);
          res = this._stack.pop() + ".";
          }
          Severity: Minor
          Found in src/core/expressions/compiler.ts and 1 other location - About 50 mins to fix
          src/core/expressions/compiler.ts on lines 843..846

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

          if (node.obj !== null) {
          this.visit(node.obj);
          res = this._stack.pop() + ".";
          }
          Severity: Minor
          Found in src/core/expressions/compiler.ts and 1 other location - About 50 mins to fix
          src/core/expressions/compiler.ts on lines 886..889

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

          constructor(test: Expression, ifTrue: Expression, ifFalse: Expression) {
          super(ExpressionType.Condition);
          this._test = test;
          this._ifTrue = ifTrue;
          this._ifFalse = ifFalse;
          Severity: Minor
          Found in src/core/expressions/compiler.ts and 1 other location - About 40 mins to fix
          src/core/expressions/compiler.ts on lines 501..506

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

          constructor(expression: Expression, methodName: string, args: Expression[]) {
          super(ExpressionType.Call);
          this._expression = expression;
          this._method = methodName;
          this._args = args;
          Severity: Minor
          Found in src/core/expressions/compiler.ts and 1 other location - About 40 mins to fix
          src/core/expressions/compiler.ts on lines 368..373

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

          visit(node: Expression): Expression {
          if (node === null) {
          return null;
          }
          return node.accept(this);
          Severity: Minor
          Found in src/core/expressions/compiler.ts and 1 other location - About 35 mins to fix
          src/core/expressions/compiler.ts on lines 150..155

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

          visit(node: Expression): T {
          if (node === null) {
          return null;
          }
          return node.acceptGeneric(this);
          Severity: Minor
          Found in src/core/expressions/compiler.ts and 1 other location - About 35 mins to fix
          src/core/expressions/compiler.ts on lines 193..198
          Category
          Status