MichaReiser/speedy.js

View on GitHub

Showing 322 of 322 total issues

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

            if ((left.flags & ts.TypeFlags.Object || isMaybeObjectType(left)) && right.flags & ts.TypeFlags.Undefined) {
                return left;
            }
packages/compiler/src/code-generation/value/undefined.ts on lines 52..54

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

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

Avoid too many return statements within this function.
Open

            return this.getVoidType(place);
Severity: Major
Found in packages/compiler/src/code-generation/util/default-type-converter.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return context.builder.createICmpNE(llvmValue, llvm.Constant.getNullValue(llvmValue.type), `${llvmValue.name}AsBool`);
    Severity: Major
    Found in packages/compiler/src/code-generation/value/primitive.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return type;
      Severity: Major
      Found in packages/compiler/src/typescript-type-checker.ts - About 30 mins to fix

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

            private getNameMangler() {
                return this.runtimeFn ? new RuntimeSystemNameMangler(this.context.compilationContext) : new DefaultNameMangler(this.context.compilationContext);
            }
        packages/compiler/src/code-generation/util/computed-object-property-reference-builder.ts on lines 46..48

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

        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

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

            private getNameMangler() {
                return this.runtimeFn ? new RuntimeSystemNameMangler(this.context.compilationContext) : new DefaultNameMangler(this.context.compilationContext);
            }
        packages/compiler/src/code-generation/util/object-index-reference-builder.ts on lines 45..47

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

        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

        Avoid too many return statements within this function.
        Open

                    return `PF${this.typeToCode(resolvedFunction.returnType)}${parameterCodes}`;
        Severity: Major
        Found in packages/compiler/src/code-generation/base-name-mangler.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return undefined;
          Severity: Major
          Found in packages/compiler/src/code-generation/value/primitive.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return this.getObjectType(type as ts.ObjectType, classReference, place);
            Severity: Major
            Found in packages/compiler/src/code-generation/util/default-type-converter.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return objectReference;

                Avoid too many return statements within this function.
                Open

                            return this.getUndefinedType(place);
                Severity: Major
                Found in packages/compiler/src/code-generation/util/default-type-converter.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return this.throwUnknownConversionError(type);
                  Severity: Major
                  Found in packages/compiler/src/code-generation/util/default-type-converter.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return this.convert(type.getNonNullableType(), place);
                    Severity: Major
                    Found in packages/compiler/src/code-generation/util/default-type-converter.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return "?" + this.typeToCode(type.getNonNullableType());
                      Severity: Major
                      Found in packages/compiler/src/code-generation/base-name-mangler.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return undefined;
                        Severity: Major
                        Found in packages/compiler/src/code-generation/value/undefined.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return llvm.FunctionType.get(this.convert(callSignature.getReturnType(), place & TypePlace.RETURN_VALUE), parameterTypes, false).getPointerTo();
                          Severity: Major
                          Found in packages/compiler/src/code-generation/util/default-type-converter.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return ts.createLiteral(value);

                              Avoid too many return statements within this function.
                              Open

                                          return `${objectName}${typeArgumentsPostfix}`;
                              Severity: Major
                              Found in packages/compiler/src/code-generation/base-name-mangler.ts - About 30 mins to fix

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

                                        if (!whenFalse) {
                                            const whenFalseTypeName = context.typeChecker.typeToString(whenFalseType);
                                            throw CodeGenerationDiagnostics.unsupportedImplicitCastOfConditionalResult(node.whenFalse, conditionalTypeName, whenFalseTypeName);
                                        }
                                packages/compiler/src/code-generation/code-generators/conditional-expression-code-generator.ts on lines 31..34

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

                                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 castToJs(returnValue: ts.Expression, type: ts.Type, loadWasmFunctionIdentifier: ts.Identifier, typesIdentifier: ts.Identifier): ts.Expression {
                                        // wasm code returns 1 for true and zero for false. Cast it to a boolean
                                        if (type.flags & ts.TypeFlags.BooleanLike) {
                                            return ts.createBinary(returnValue, ts.SyntaxKind.EqualsEqualsEqualsToken, ts.createNumericLiteral("1"));
                                        }
                                packages/compiler/src/code-generation/per-file/per-file-code-generator-source-file-rewriter.ts on lines 185..202

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

                                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