Showing 100 of 322 total issues
Avoid too many return
statements within this function. Open
return this.getUndefinedType(place);
Avoid too many return
statements within this function. Open
return this.throwUnknownConversionError(type);
Avoid too many return
statements within this function. Open
return this.convert(type.getNonNullableType(), place);
Avoid too many return
statements within this function. Open
return "?" + this.typeToCode(type.getNonNullableType());
Avoid too many return
statements within this function. Open
return undefined;
Avoid too many return
statements within this function. Open
return llvm.FunctionType.get(this.convert(callSignature.getReturnType(), place & TypePlace.RETURN_VALUE), parameterTypes, false).getPointerTo();
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}`;
Function toNumber
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static toNumber(value: Value, valueType: ts.Type, numberType: ts.Type, context: CodeGenerationContext) {
let numberValue: llvm.Value;
const llvmValue = value.generateIR(context);
if (valueType.flags & ts.TypeFlags.BooleanLike) {
- Read upRead up
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 emit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static emit(program: ts.Program, compilationContext: CompilationContext) {
const codeGenerationContextFactory = new DefaultCodeGenerationContextFactory(new NotYetImplementedCodeGenerator());
const codeGenerator = new PerFileCodeGenerator(compilationContext.llvmContext, codeGenerationContextFactory);
const logUnknownVisitor = new LogUnknownTransformVisitor();
- Read upRead up
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 invokeResolvedFunction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private invokeResolvedFunction(resolvedFunction: ResolvedFunction, args: llvm.Value[], callerContext: CodeGenerationContext) {
const llvmFunction = this.getLLVMFunction(resolvedFunction, callerContext, args);
assert(llvmFunction.type.isPointerTy() && (llvmFunction.type as llvm.PointerType).elementType.isFunctionTy(), "Expected pointer to a function type");
const callArguments = this.getCallArguments(resolvedFunction, args, callerContext);
- Read upRead up
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 getTypeAtLocation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getTypeAtLocation(node: ts.Node): ts.Type {
let type = this.toSupportedType(this.tsTypeChecker.getTypeAtLocation(node));
// e.g. when const x: int[] = [] then the type of [] is never[] that is quite unfortunate. Take the contextual
// type information into consideration in this case (but do not otherwise. Otherwise let x: number = 3 returns unexpected results.
- Read upRead up
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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static create(type: ts.ObjectType, context: CodeGenerationContext) {
const baseTypes = type.getBaseTypes();
const declaration = type.getSymbol().valueDeclaration as ts.ClassDeclaration;
if (baseTypes && type.getBaseTypes().length > 0) {
- Read upRead up
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 isFunctionType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function isFunctionType(type: ts.Type) {
if (type.flags & ts.TypeFlags.Union) {
const unionType = type as ts.UnionType;
if (unionType.types.length === 2 && unionType.types.some(t => !!(t.flags & ts.TypeFlags.Undefined))) {
- Read upRead up
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 toLlvmArgumentTypes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private toLlvmArgumentTypes(resolvedFunction: ResolvedFunction,
numberOfArguments: number,
context: CodeGenerationContext,
objectReference?: ObjectReference) {
const argumentTypes = objectReference ? [this.typeConverter.convert(objectReference.type, TypePlace.THIS)] : [];
- Read upRead up
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 createTransformer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function createTransformer(transformVisitor: TransformVisitor, transformationContext: ts.TransformationContext): ts.Transformer<ts.SourceFile> {
const context: TransformVisitorContext = {
requestEmitHelper(emitHelper: ts.EmitHelper): void {
transformationContext.requestEmitHelper(emitHelper);
},
- Read upRead up
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 castImplicit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
castImplicit(type: ts.Type, context: CodeGenerationContext): Value | undefined {
if (this.type === type) {
return this;
}
- Read upRead up
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 toInt32
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static toInt32(value: Value, valueType: ts.Type, int32Type: ts.Type, context: CodeGenerationContext) {
let intValue: llvm.Value;
if (valueType.flags & ts.TypeFlags.IntLike) {
intValue = value.generateIR(context);
- Read upRead up
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 invoke
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function invoke(callee: FunctionPointer, args: llvm.Value[], returnType: llvm.Type, callerContext: CodeGenerationContext, options?: InvokeOptions) {
const functionType = callee.type.elementType;
const initializedOptions = options || {};
assert(args.length === functionType.numParams, `Calling function with less arguments than declared parameters`);
- Read upRead up
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 verifyIsSupportedSpeedyJSFunction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function verifyIsSupportedSpeedyJSFunction(declaration: ts.Declaration, context: CodeGenerationContext) {
// tslint:disable-next-line: max-line-length
if (!(declaration.kind === ts.SyntaxKind.FunctionDeclaration || declaration.kind === ts.SyntaxKind.MethodDeclaration || declaration.kind === ts.SyntaxKind.Constructor)) {
throw CodeGenerationDiagnostics.unsupportedFunctionDeclaration(declaration);
}
- Read upRead up
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"