MichaReiser/speedy.js

View on GitHub

Showing 322 of 322 total issues

Function __moduleLoader has 373 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function __moduleLoader(this: any, wasmUri: string, options: Options): ModuleLoader {
    const PTR_SIZE = 4;
    const PTR_SHIFT = Math.log2(PTR_SIZE);

    function sizeOf(type: string): int {

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

        describe("x > y", () => {
            it("returns true for true compared to false and false otherwise", async (cb) => {
                expect(await boolGreaterThan(true, false)).toBe(true > false);
                expect(await boolGreaterThan(true, true)).toBe(true > true);
                expect(await boolGreaterThan(false, false)).toBe(false > false);
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 743..765
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 767..789
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 791..813

    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 333.

    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

        describe("!==", () => {
            it("returns false for equal boolean values and true otherwise", async (cb) => {
                expect(await boolsNotEqual(true, true)).toBe(true !== true);
                expect(await boolsNotEqual(true, false)).toBe(true !== false as any);
                cb();
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 661..688

    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 333.

    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

        describe("===", () => {
            it("returns true for equal boolean values and false otherwise", async (cb) => {
                expect(await boolsEqual(true, true)).toBe(true === true);
                expect(await boolsEqual(true, false)).toBe(true === false as any);
                cb();
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 690..717

    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 333.

    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 4 locations. Consider refactoring.
    Open

        describe("x < y", () => {
            it("returns true for false compared to false and false otherwise", async (cb) => {
                expect(await boolLessThan(true, false)).toBe(true < false);
                expect(await boolLessThan(true, true)).toBe(true < true);
                expect(await boolLessThan(false, false)).toBe(false < false);
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 719..741
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 743..765
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 791..813

    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 333.

    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 4 locations. Consider refactoring.
    Open

        describe("x <= y", () => {
            it("returns false for true <= false", async (cb) => {
                expect(await boolLessThanEquals(true, false)).toBe(true <= false);
                expect(await boolLessThanEquals(true, true)).toBe(true <= true);
                expect(await boolLessThanEquals(false, false)).toBe(false <= false);
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 719..741
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 743..765
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 767..789

    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 333.

    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 4 locations. Consider refactoring.
    Open

        describe("x >= y", () => {
            it("returns true for true >= true, true >= false and false >= false", async (cb) => {
                expect(await boolGreaterThanEquals(true, false)).toBe(true >= false);
                expect(await boolGreaterThanEquals(true, true)).toBe(true >= true);
                expect(await boolGreaterThanEquals(false, false)).toBe(false >= false);
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 719..741
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 767..789
    packages/compiler/__integrationtests__/binary-expression.spec.ts on lines 791..813

    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 333.

    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 __moduleLoader has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
    Open

    function __moduleLoader(this: any, wasmUri: string, options: Options): ModuleLoader {
        const PTR_SIZE = 4;
        const PTR_SHIFT = Math.log2(PTR_SIZE);
    
        function sizeOf(type: string): int {

    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 binary-expression.spec.ts has 719 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class SimpleClass {}
    
    async function addInts(x: int, y: int) {
        "use speedyjs";
    
    
    Severity: Major
    Found in packages/compiler/__integrationtests__/binary-expression.spec.ts - About 1 day to fix

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

                  case ts.SyntaxKind.LessThanToken: {
                      const unifiedType = BinaryExpressionCodeGenerator.unifyTypes(binaryExpression, context);
      
                      const leftIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.left, binaryExpression, context).generateIR(context);
                      const rightIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.right, binaryExpression, context).generateIR(context);
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 209..225
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 228..244
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 291..308

      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 300.

      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 4 locations. Consider refactoring.
      Open

                  case ts.SyntaxKind.GreaterThanEqualsToken: {
                      const unifiedType = BinaryExpressionCodeGenerator.unifyTypes(binaryExpression, context);
      
                      const leftIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.left, binaryExpression, context).generateIR(context);
                      const rightIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.right, binaryExpression, context).generateIR(context);
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 209..225
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 271..288
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 291..308

      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 300.

      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 4 locations. Consider refactoring.
      Open

                  case ts.SyntaxKind.GreaterThanToken: {
                      const unifiedType = BinaryExpressionCodeGenerator.unifyTypes(binaryExpression, context);
      
                      const leftIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.left, binaryExpression, context).generateIR(context);
                      const rightIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.right, binaryExpression, context).generateIR(context);
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 228..244
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 271..288
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 291..308

      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 300.

      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 4 locations. Consider refactoring.
      Open

                  case ts.SyntaxKind.LessThanEqualsToken: {
                      const unifiedType = BinaryExpressionCodeGenerator.unifyTypes(binaryExpression, context);
      
                      const leftIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.left, binaryExpression, context).generateIR(context);
                      const rightIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.right, binaryExpression, context).generateIR(context);
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 209..225
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 228..244
      packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 271..288

      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 300.

      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 generate has 269 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          generate(binaryExpression: ts.BinaryExpression, context: CodeGenerationContext): Value {
              const leftType = context.typeChecker.getTypeAtLocation(binaryExpression.left);
              const rightType = context.typeChecker.getTypeAtLocation(binaryExpression.right);
              const resultType = context.typeChecker.getTypeAtLocation(binaryExpression);
      
      

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

                    case ts.SyntaxKind.EqualsEqualsEqualsToken: {
                        const unifiedType = BinaryExpressionCodeGenerator.unifyTypes(binaryExpression, context);
        
                        const leftIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.left, binaryExpression, context).generateIR(context);
                        const rightIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.right, binaryExpression, context).generateIR(context);
        packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 192..206

        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 229.

        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

                    case ts.SyntaxKind.ExclamationEqualsEqualsToken: {
                        const unifiedType = BinaryExpressionCodeGenerator.unifyTypes(binaryExpression, context);
        
                        const leftIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.left, binaryExpression, context).generateIR(context);
                        const rightIr = BinaryExpressionCodeGenerator.toUnified(binaryExpression.right, binaryExpression, context).generateIR(context);
        packages/compiler/src/code-generation/code-generators/binary-expression-code-generator.ts on lines 174..188

        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 229.

        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

        class ContinueStatementCodeGenerator implements SyntaxCodeGenerator<ts.ContinueStatement, void> {
            syntaxKind = ts.SyntaxKind.ContinueStatement;
        
            generate(node: ts.ContinueStatement, context: CodeGenerationContext): void {
                let target: llvm.BasicBlock | undefined;
        packages/compiler/src/code-generation/code-generators/break-statement-code-generator.ts on lines 9..26

        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 196.

        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

        class BreakStatementCodeGenerator implements SyntaxCodeGenerator<ts.BreakStatement, void> {
            syntaxKind = ts.SyntaxKind.BreakStatement;
        
            generate(breakStatement: ts.BreakStatement, context: CodeGenerationContext): void {
                let target: llvm.BasicBlock | undefined;
        packages/compiler/src/code-generation/code-generators/continue-statement-code-generator.ts on lines 9..26

        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 196.

        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

            private setContinueAndBreakLabels(parent: ts.Node | undefined, context: CodeGenerationContext, condition: llvm.BasicBlock, end: llvm.BasicBlock) {
                context.scope.setContinueBlock(condition);
                context.scope.setBreakBlock(end);
        
                if (parent && parent.kind === ts.SyntaxKind.LabeledStatement) {
        packages/compiler/src/code-generation/code-generators/for-statement-code-generator.ts on lines 57..69

        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 184.

        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

            private setContinueAndBreakLabels(parent: ts.Node | undefined, context: CodeGenerationContext, incrementer: llvm.BasicBlock, end: llvm.BasicBlock) {
                context.scope.setContinueBlock(incrementer);
                context.scope.setBreakBlock(end);
        
                if (parent && parent.kind === ts.SyntaxKind.LabeledStatement) {
        packages/compiler/src/code-generation/code-generators/while-statement-code-generator.ts on lines 37..49

        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 184.

        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

        Severity
        Category
        Status
        Source
        Language