Showing 100 of 322 total issues
Function build
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function build() {
if (!fs.existsSync(TOOLS_DIRECTORY)) {
fs.mkdirSync(TOOLS_DIRECTORY);
}
Function from
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
static from(native: any[], elementType: string, types: Types, objectReferences: Map<object, int>): RuntimeArray {
// begin, back, capacity
const size = PTR_SIZE * 2 + sizeOf("i32");
const arrayPtr = malloc(size);
const elementSize = sizeOf(elementType);
Function generate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
generate(ifStatement: ts.IfStatement, context: CodeGenerationContext): void {
const fun = context.scope.enclosingFunction;
let thenBlock = llvm.BasicBlock.create(context.llvmContext, "if.then");
let elseBlock = llvm.BasicBlock.create(context.llvmContext, "if.else");
const end = llvm.BasicBlock.create(context.llvmContext, "if.end");
Function createTransformer
has 26 lines of code (exceeds 25 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);
},
Function emit
has 26 lines of code (exceeds 25 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();
Function createResolvedFunction
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
export function createResolvedFunction(name: string,
typeParameters: ts.Type[],
parameters: ResolvedFunctionParameter[],
returnType: ts.Type,
sourceFile?: ts.SourceFile,
Function isSpeedyJSFunction
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function isSpeedyJSFunction(fun: ts.FunctionLikeDeclaration) {
if (!fun.body || !isBlock(fun.body)) {
return false;
}
- 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 visitIdentifier
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
visitIdentifier(identifier: ts.Identifier, context: TransformVisitorContext) {
const symbol = this.compilationContext.typeChecker.getSymbolAtLocation(identifier);
if (typeof symbol !== "undefined" && symbol.flags & (ts.SymbolFlags.Function | ts.SymbolFlags.Method | ts.SymbolFlags.Constructor)) {
for (const declaration of symbol.getDeclarations() as ts.FunctionLikeDeclaration[]) {
- 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 serializedTypeName
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function serializedTypeName(type: ts.Type, typeChecker: TypeChecker): string {
if (isMaybeObjectType(type)) {
type = type.getNonNullableType();
}
- 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 value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
value(this: CodeGenerationContext, value: llvm.Value, type: ts.Type): Value {
const symbol = type.getSymbol();
if (type.flags & (ts.TypeFlags.BooleanLike | ts.TypeFlags.NumberLike | ts.TypeFlags.IntLike)) {
return new Primitive(value, type);
- 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 getCallArguments
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected getCallArguments(resolvedFunction: ResolvedFunction, passedArguments: llvm.Value[], callerContext: CodeGenerationContext): llvm.Value[] {
const result: llvm.Value[] = [];
for (let i = 0; i < resolvedFunction.parameters.length; ++i) {
const parameter = resolvedFunction.parameters[i];
- 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 getObjectFilesToLink
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private getObjectFilesToLink(objectFiles: string[], entrySymbols: string[]) {
let loopAgain = true;
const includedObjectFiles = new Set<string>();
const unresolvedSymbols = new Set<string>(entrySymbols);
- 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 arraySpliceInsertingNewElements
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
async function arraySpliceInsertingNewElements(array: int[], start: int, deleteCount: int, a: int, b: int, c: int, d: int) {
Function generate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
generate(identifier: ts.Identifier, context: CodeGenerationContext): Value {
let symbol = context.typeChecker.getSymbolAtLocation(identifier);
if (symbol.flags & ts.SymbolFlags.Alias) {
symbol = context.typeChecker.getAliasedSymbol(symbol);
- 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 toLiteral
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function toLiteral(value: any): ts.Expression {
if (Array.isArray(value)) {
return ts.createArrayLiteral(value.map(element => toLiteral(element)));
} else if (typeof value === "object") {
if (value.kind && value.flags) { // ts node
- 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 compileSourceCode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function compileSourceCode(sourceCode: string, inputFileName: string, options?: UninitializedSpeedyJSCompilerOptions) {
const initializedOptions = getInitializedCompilerOptions(options);
const defaultHost = ts.createCompilerHost(initializedOptions);
- 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 generate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
generate(postfixUnaryExpression: ts.PostfixUnaryExpression, context: CodeGenerationContext): Value {
const left = context.generateValue(postfixUnaryExpression.operand);
const before = left.generateIR(context);
let updated: llvm.Value | undefined;
const operandType = context.typeChecker.getTypeAtLocation(postfixUnaryExpression.operand);
- 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 forBreakToLabel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function forBreakToLabel() {
"use speedyjs";
let result = 0;
loop1:
- 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 ifElseIfElse
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function ifElseIfElse(condition: boolean, ifValue: number, elseIfCondition: boolean, elseIfValue: number, elseValue: number) {
Function makeSourceMap
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function makeSourceMap(sourceMapText, outputText, filePath, contents, loader) {