tom-weatherhead/thaw-grammar

View on GitHub

Showing 76 of 181 total issues

Function evaluateValueOp has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
Open

    private evaluateValueOp(
        evaluatedArguments: ISmalltalkValue[],
        globalInfo: ISmalltalkGlobalInfo
    ): ISmalltalkValue {
        evaluatedArguments = evaluatedArguments.map((arg) => unblockValue(arg));
Severity: Minor
Found in src/languages/smalltalk/domain-object-model/operator-usage.ts - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function evaluateValueOp has 315 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private evaluateValueOp(
        evaluatedArguments: ISmalltalkValue[],
        globalInfo: ISmalltalkGlobalInfo
    ): ISmalltalkValue {
        evaluatedArguments = evaluatedArguments.map((arg) => unblockValue(arg));
Severity: Major
Found in src/languages/smalltalk/domain-object-model/operator-usage.ts - About 1 day to fix

    File operator-usage.ts has 597 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // tom-weatherhead/thaw-grammar/src/languages/smalltalk/domain-object-model/operator-usage.ts
    
    import { EvaluationException, Name } from 'thaw-interpreter-core';
    
    import { EnvironmentFrame } from '../../../common/domain-object-model/environment-frame';
    Severity: Major
    Found in src/languages/smalltalk/domain-object-model/operator-usage.ts - About 1 day to fix

      Function objectToString_ApostrophesToQuoteKeywords has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          public objectToString_ApostrophesToQuoteKeywords(expr: unknown): string {
              if (isFunctionDefinition<ISExpression>(expr)) {
                  return `(define ${expr.functionName} (${expr.argList
                      .map((a) => a.name)
                      .join(' ')}) ${this.objectToString_ApostrophesToQuoteKeywords(expr.body)})`;
      Severity: Minor
      Found in src/languages/lisp/domain-object-model/macro-definition.ts - About 6 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function evaluate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public evaluate(
              globalInfo: IGlobalInfo<ICLUValue>,
              localEnvironment?: IEnvironmentFrame<ICLUValue>,
              options?: unknown
          ): ICLUValue {
      Severity: Minor
      Found in src/languages/clu/domain-object-model/operator-usage.ts - About 5 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function objectToString_ApostrophesToQuoteKeywords has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public objectToString_ApostrophesToQuoteKeywords(expr: unknown): string {
              if (isFunctionDefinition<ISExpression>(expr)) {
                  return `(define ${expr.functionName} (${expr.argList
                      .map((a) => a.name)
                      .join(' ')}) ${this.objectToString_ApostrophesToQuoteKeywords(expr.body)})`;
      Severity: Major
      Found in src/languages/lisp/domain-object-model/macro-definition.ts - About 3 hrs to fix

        Function evaluate has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public evaluate(
                globalInfo: IGlobalInfo<ICLUValue>,
                localEnvironment?: IEnvironmentFrame<ICLUValue>,
                options?: unknown
            ): ICLUValue {
        Severity: Major
        Found in src/languages/clu/domain-object-model/operator-usage.ts - About 3 hrs to fix

          APLValue has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class APLValue implements IAPLValue {
              public static createNull(): IAPLValue {
                  return new APLValue([], []);
              }
          
          
          Severity: Minor
          Found in src/languages/apl/domain-object-model/data-types/value.ts - About 3 hrs to fix

            Function evaluate has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public evaluate(
                    globalInfo: ISmalltalkGlobalInfo, // I.e. IGlobalInfo<ISmalltalkValue>
                    localEnvironment: ISmalltalkEnvironmentFrame | undefined, // I.e. IEnvironmentFrame<ISmalltalkValue> | undefined
                    options?: unknown
                ): ISmalltalkValue {
            Severity: Major
            Found in src/languages/smalltalk/domain-object-model/operator-usage.ts - About 3 hrs to fix

              Function evaluate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  public evaluate(
                      globalInfo: ISmalltalkGlobalInfo, // I.e. IGlobalInfo<ISmalltalkValue>
                      localEnvironment: ISmalltalkEnvironmentFrame | undefined, // I.e. IEnvironmentFrame<ISmalltalkValue> | undefined
                      options?: unknown
                  ): ISmalltalkValue {
              Severity: Minor
              Found in src/languages/smalltalk/domain-object-model/operator-usage.ts - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              File operators.ts has 281 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // tom-weatherhead/thaw-grammar/src/languages/lambda-calculus/operators.ts
              
              import { ifDefinedThenElse } from 'thaw-common-utilities.ts';
              
              import { ILCExpression } from './domain-object-model/interfaces/expression';
              Severity: Minor
              Found in src/languages/lambda-calculus/operators.ts - About 2 hrs to fix

                Function toStringHelper has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private toStringHelper(
                        sb: string,
                        offsetVector: number[],
                        offset: number,
                        firstSlice: boolean
                Severity: Minor
                Found in src/languages/apl/domain-object-model/data-types/value.ts - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function compose has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public compose(otherSub: ISubstitution): ISubstitution {
                        const newSub = new PrologSubstitution();
                
                        // 1) Apply the Src substitution to this's terms.
                
                
                Severity: Minor
                Found in src/languages/prolog/domain-object-model/prolog-substitution.ts - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function evaluateNormal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected evaluateNormal(
                        funDef: CLUNormalFunctionDefinition | undefined,
                        evaluatedArguments: ICLUValue[],
                        cluster: ICluster | undefined,
                        globalInfo: IGlobalInfo<ICLUValue>
                Severity: Minor
                Found in src/languages/clu/domain-object-model/operator-usage.ts - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function constructor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    constructor(public readonly shape: number[], srcList?: number[]) {
                        // console.log(`shape (length ${shape.length}) is:`, shape);
                        // console.log('srcList is', typeof srcList, srcList);
                
                        if (this.shape.some((s) => s < 0)) {
                Severity: Minor
                Found in src/languages/apl/domain-object-model/data-types/value.ts - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                File operator-usage.ts has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // clu/domain-object-model/operator-usage.ts
                
                // import { ArgumentException } from 'thaw-interpreter-core';
                
                import {
                Severity: Minor
                Found in src/languages/clu/domain-object-model/operator-usage.ts - About 2 hrs to fix

                  Function toStringHelper has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private toStringHelper(
                          sb: string,
                          offsetVector: number[],
                          offset: number,
                          firstSlice: boolean
                  Severity: Major
                  Found in src/languages/apl/domain-object-model/data-types/value.ts - About 2 hrs to fix

                    Function evaluateAux has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected evaluateAux(
                            evaluatedArguments: T[],
                            globalInfo: IGlobalInfo<T>,
                            localEnvironment?: IEnvironmentFrame<T>,
                            options?: unknown
                    Severity: Major
                    Found in src/common/domain-object-model/operator-usage.ts - About 2 hrs to fix

                      Function compose has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public compose(otherSub: ISubstitution): ISubstitution {
                              const newSub = new PrologSubstitution();
                      
                              // 1) Apply the Src substitution to this's terms.
                      
                      
                      Severity: Minor
                      Found in src/languages/prolog/domain-object-model/prolog-substitution.ts - About 1 hr to fix

                        Function compose has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public compose(otherSub: ILCSubstitution): ILCSubstitution {
                                const newSub = new LCSubstitution();
                        
                                // 1) Apply the Src substitution to this's terms.
                        
                        
                        Severity: Minor
                        Found in src/languages/lambda-calculus/domain-object-model/substitution.ts - About 1 hr to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language