Showing 100 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 {
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 {
- 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
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";
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);
Function generate
has a Cognitive Complexity of 46 (exceeds 5 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);
- 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
LogUnknownTransformVisitor
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
export class LogUnknownTransformVisitor implements TransformVisitor {
visitSourceFile(sourceFile: ts.SourceFile, context: TransformVisitorContext): ts.SourceFile {
return context.visitEachChild(sourceFile);
}
File get-wasm-module-function.ts
has 400 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* This file includes a single statement, the function declaration of the getWasmModuleFactory. This function is used in the
* speedyjs-transformer to generate the code to load the wasm module.
* The code is inspired by https://github.com/kripken/emscripten/blob/incoming/src/runtime.js
*/
CodeGenerationDiagnostics
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
export class CodeGenerationDiagnostics {
static toDiagnostic(error: CodeGenerationDiagnostic): ts.Diagnostic {
const message = error.code === 0 ? `${error.message}\n${error.stack}` : error.message;
return {
code: error.code,
File binary-expression-code-generator.ts
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as llvm from "llvm-node";
import * as ts from "typescript";
import {CodeGenerationDiagnostics} from "../../code-generation-diagnostic";
import {CodeGenerationContext} from "../code-generation-context";
import {SyntaxCodeGenerator} from "../syntax-code-generator";
File array.spec.ts
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Point {
x: number;
y: number;
constructor(x: number, y: number) {
this.x = x;
File code-generation-diagnostic.ts
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as ts from "typescript";
import * as util from "util";
/**
* Error thrown during code generation. Has a node attach allowing to identify the source of the error.
Function loadInstance
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadInstance(): Promise<WebAssemblyInstance> {
let instance: WebAssemblyInstance;
let wasmLoaded: Promise<ArrayBuffer>;
// browser
Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",
Function compileSourceCode
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function compileSourceCode(sourceCode: string, inputFileName: string, options?: UninitializedSpeedyJSCompilerOptions) {
const initializedOptions = getInitializedCompilerOptions(options);
const defaultHost = ts.createCompilerHost(initializedOptions);
Scope
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export class Scope {
private variables = new Map<ts.Symbol, Value>();
private functions: Map<ts.Symbol, FunctionReference>;
private classes: Map<ts.Symbol, ClassReference>;
private returnAlloca: Allocation | undefined;
Function generate
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
generate(node: ts.PrefixUnaryExpression, context: CodeGenerationContext): Value {
const left = context.generateValue(node.operand);
const operandType = context.typeChecker.getTypeAtLocation(node.operand);
const resultType = context.typeChecker.getTypeAtLocation(node);
let result: llvm.Value | 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
File classes.spec.ts
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
class DefaultInitializeClassWithAttributesOnly {
x: number;
y: number;
}
Function speedyJSLoader
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function speedyJSLoader(source) {
const loader = this;
const wasmFileWriter = {
- 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 speedyJSLoader
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function speedyJSLoader(source) {
const loader = this;
const wasmFileWriter = {
Function generate
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
generate(node: ts.PrefixUnaryExpression, context: CodeGenerationContext): Value {
const left = context.generateValue(node.operand);
const operandType = context.typeChecker.getTypeAtLocation(node.operand);
const resultType = context.typeChecker.getTypeAtLocation(node);
let result: llvm.Value | undefined;