Showing 86 of 242 total issues
Function nls
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
protected nls(spheres: Array<Sphere<any>>): AbsolutePosition {
// Initiailize parameters
const f = (point: number[]) => this._calculateError(point, spheres);
const x0 = this._calculateInit(spheres);
const maxIterations = this.options.maxIterations;
- 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 Deserializer.ts
has 454 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Deserializer as JSONDeserializer } from 'typedjson/lib/cjs/deserializer';
import type { TypeDescriptor } from 'typedjson/lib/types/type-descriptor';
import {
ensureTypeDescriptor,
ConcreteTypeDescriptor,
Function convertAsObject
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
convertAsObject<T>(
sourceObject: IndexedObject,
typeDescriptor: ConcreteTypeDescriptor,
knownTypes: Map<string, Serializable<any>>,
memberName: string,
Function nls
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected nls(spheres: Array<Sphere<any>>): AbsolutePosition {
// Initiailize parameters
const f = (point: number[]) => this._calculateError(point, spheres);
const x0 = this._calculateInit(spheres);
const maxIterations = this.options.maxIterations;
Function convertAsObject
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
convertAsObject<T>(
sourceObject: IndexedObject,
typeDescriptor: ConcreteTypeDescriptor,
knownTypes: Map<string, Serializable<any>>,
memberName: string,
- 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 MultilaterationNode.ts
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { AbsolutePosition, Accuracy1D, DataObject, GeographicalPosition, RelativeDistance } from '../../data';
import { DataFrame } from '../../data/DataFrame';
import { AngleUnit } from '../../utils';
import { Vector3 } from '../../utils/math';
import { ObjectProcessingNodeOptions } from '../ObjectProcessingNode';
File Serializer.ts
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Serializer as JSONSerializer } from 'typedjson/lib/cjs/serializer';
import type { ConcreteTypeDescriptor, TypeDescriptor } from 'typedjson/lib/types/type-descriptor';
import {
ensureTypeDescriptor,
ArrayTypeDescriptor,
Function convertAsMap
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
convertAsMap(
sourceObject: any,
typeDescriptor: MapTypeDescriptor,
knownTypes: Map<string, Serializable<any>>,
memberName: string,
Function processRelativePositions
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
processRelativePositions<P extends AbsolutePosition>(
dataObject: DataObject,
relativePositions: Map<RelativeDistance, DataObject>,
dataFrame: DataFrame,
): Promise<DataObject> {
Function init
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
init(config: WorkerData): Promise<void> {
return new Promise(async (resolve, reject) => {
this.config = config;
const importFn: (file: string) => Promise<any> =
typeof process !== 'object'
File WorkerHandler.ts
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { BlobWorker, Pool, spawn, Thread, Worker } from 'threads';
import { PoolEvent } from 'threads/dist/master/pool';
import { Observable } from 'threads/observable';
import { DataFrame } from '../data/DataFrame';
import { DataSerializer } from '../data/DataSerializer';
Function convertAsObject
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
convertAsObject(
sourceObject: IndexedObject,
typeDescriptor: ConcreteTypeDescriptor,
memberName: string,
serializer: Serializer,
File Unit.ts
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
import 'reflect-metadata';
import { SerializableObject, SerializableMember } from '../../data/decorators';
import { UnitOptions } from './UnitOptions';
import { UnitBasicDefinition, UnitDefinition, UnitFunctionDefinition, UnitValueType } from './UnitDefinition';
import { UnitPrefix, UnitPrefixType } from './UnitPrefix';
Function updateSerializableMember
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function updateSerializableMember(
target: unknown,
propertyKey: string,
options: SerializableMemberOptions | IndexedObject,
) {
- 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
ReferenceSpace
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@SerializableObject()
export class ReferenceSpace extends DataObject implements TransformationSpace {
@SerializableMember({
name: 'translationMatrix',
})
Function _spawnWorker
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _spawnWorker(): Promise<Thread> {
return new Promise((resolve, reject) => {
const worker = this.createWorker();
spawn(worker, {
timeout: this.options.timeout,
Function findByName
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
static findByName(name: string, baseName?: string): Unit | undefined {
if (name === undefined) {
return undefined;
} else if (Unit.UNITS.has(name)) {
return Unit.UNITS.get(name);
- 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 getCurrentPosition
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
getCurrentPosition(object: T | string, options: GeoOptions = {}): Promise<P> {
return new Promise((resolve, reject) => {
const maximumAge = options.maximumAge || Infinity;
options.timeout = options.timeout || 10000;
const uid = object instanceof DataObject ? object.uid : object;
Function updateSerializableMember
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function updateSerializableMember(
target: unknown,
propertyKey: string,
options: SerializableMemberOptions | IndexedObject,
) {
Function convertAsMap
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
convertAsMap(
sourceObject: Map<any, any>,
typeDescriptor: MapTypeDescriptor,
memberName: string,
serializer: Serializer,