tom-weatherhead/thaw-grammar

View on GitHub

Showing 181 of 181 total issues

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

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

    export function lcaCons(options: { h?: string; t?: string; f?: string } = {}): ILCExpression {
        const h = v(options.h, 'h');
        const t = v(options.t, 't');
    
        return l(h, l(t, lcaConsUsage(h, t, options)));
    Severity: Major
    Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 3 hrs to fix
    src/languages/lambda-calculus/operators.ts on lines 235..242

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export function createFunctionCreatePair(
        options: { f?: string; a?: string; b?: string } = {}
    ): ILCExpression {
        const a = v(options.a, 'a');
        const b = v(options.b, 'b');
    Severity: Major
    Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 3 hrs to fix
    src/languages/lambda-calculus/operators.ts on lines 387..392

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 98.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

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

      export function createOperatorOr(options: { p?: string; q?: string } = {}): ILCExpression {
          // || (or) : λp.λq.(((IF p) TRUE) q)
          const p = v(options.p, 'p');
          const q = v(options.q, 'q');
      
      
      Severity: Major
      Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
      src/languages/lambda-calculus/operators.ts on lines 82..88

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      export function createOperatorAnd(options: { p?: string; q?: string } = {}): ILCExpression {
          // && (and) : λp.λq.((p q) FALSE)
          const p = v(options.p, 'p');
          const q = v(options.q, 'q');
      
      
      Severity: Major
      Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
      src/languages/lambda-calculus/operators.ts on lines 95..101

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

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

        export function createValueTrue(options: { x?: string; y?: string } = {}): ILCExpression {
            const x = v(options.x, 'x');
            const y = v(options.y, 'y');
        
            return l(x, l(y, x));
        Severity: Major
        Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
        src/languages/lambda-calculus/operators.ts on lines 40..45

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 85.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        export function createValueFalse(options: { x?: string; y?: string } = {}): ILCExpression {
            const x = v(options.x, 'x');
            const y = v(options.y, 'y');
        
            return l(x, l(y, y));
        Severity: Major
        Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
        src/languages/lambda-calculus/operators.ts on lines 33..38

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 85.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        export const falseClass = new SmalltalkClass(
            falseClassName,
            objectClassName,
            [],
            [stringValueVar],
        src/languages/smalltalk/domain-object-model/object-instance.ts on lines 154..172

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 84.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        export const trueClass = new SmalltalkClass(
            trueClassName,
            objectClassName,
            [],
            [stringValueVar],
        src/languages/smalltalk/domain-object-model/object-instance.ts on lines 134..152

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 84.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

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

        export function lcaConsUsage(
            h: ILCExpression,
            t: ILCExpression,
            options: { f?: string } = {}
        ): ILCExpression {
        Severity: Major
        Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
        src/languages/lambda-calculus/operators.ts on lines 225..233

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 81.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        export function createPairUsage(
            first: ILCExpression,
            second: ILCExpression,
            options: { f?: string } = {}
        ): ILCExpression {
        Severity: Major
        Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
        src/languages/lambda-calculus/operators.ts on lines 377..385

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 81.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

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

        export function createOperatorDecrement(
            options: { n?: string; f?: string; x?: string } = {}
        ): ILCExpression {
            // -- (predecessor) : λn.λf.λx.(((n λg.λh.(h (g f))) λu.x) λu.u)
            const n = v(options.n, 'n');
        Severity: Major
        Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
        src/languages/lambda-calculus/operators.ts on lines 131..138

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 80.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        export function createOperatorIncrement(
            options: { n?: string; f?: string; x?: string } = {}
        ): ILCExpression {
            // ++ (successor) : λn.λf.λx.(f ((n f) x))
            const n = v(options.n, 'n');
        Severity: Major
        Found in src/languages/lambda-calculus/operators.ts and 1 other location - About 2 hrs to fix
        src/languages/lambda-calculus/operators.ts on lines 154..161

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 80.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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

        Severity
        Category
        Status
        Source
        Language