Showing 87 of 247 total issues
Function loadClasses
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static loadClasses(module: NodeModule = require.main): void {
if (module === undefined) {
// Use cache instead
Object.values(require.cache).map((m) => this.loadClasses(m));
return;
Function createMetadata
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
static createMetadata(proto: IndexedObject): ObjectMetadata {
if (Object.prototype.hasOwnProperty.call(proto, this.META_FIELD)) {
return proto[this.META_FIELD];
}
// Target has no JsonObjectMetadata associated with it yet, create it now.
Function getValueFromPath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static getValueFromPath<T>(object: T, path: string): [any, any, string] {
// https://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-and-arays-by-string-path
let o: any = object;
path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
path = path.replace(/^\./, ''); // strip a leading dot
- 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 evaluateComponent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static evaluateComponent<T>(object: T, key: string, query: any): boolean {
let result = true;
const value = (object as any)[key];
if (key.startsWith('$')) {
result = result && MemoryQueryEvaluator.evaluateOp(key, object, query);
- 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
Avoid deeply nested control flow statements. Open
if (sigma >= 1) break;
Avoid deeply nested control flow statements. Open
if (contracted.fx < worst.fx) {
updateSimplex(contracted);
} else {
shouldReduce = true;
}
Function convert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
convert<T extends UnitValueType>(value: T, target: string | Unit): T {
const targetUnit: Unit = target instanceof Unit ? target : Unit.findByName(target, this.baseName);
// Do not convert if target unit is the same or undefined
if (!targetUnit || targetUnit.name === this.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 registerUnit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static registerUnit(unit: Unit, override: boolean = false): Unit {
if (!unit.name) {
return unit;
}
- 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 constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(worker: ((...args: any[]) => void) | string | Node<In, Out>, options?: WorkerNodeOptions) {
super(options);
this.options.worker = this.options.worker || '../worker/WorkerRunner';
this.options.type = this.options.type || 'classic';
if (worker instanceof GraphBuilder) {
- 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 convertAsMap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
convertAsMap(
sourceObject: any,
typeDescriptor: MapTypeDescriptor,
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
Avoid deeply nested control flow statements. Open
if (contracted.fx < reflected.fx) {
updateSimplex(contracted);
} else {
shouldReduce = true;
}
Avoid deeply nested control flow statements. Open
for (let i = 1; i < simplex.length; ++i) {
weightedSum(simplex[i], 1 - sigma, simplex[0], sigma, simplex[i]);
simplex[i].fx = f(simplex[i]);
}
Function transform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public transform<In extends AbsolutePosition, Out extends AbsolutePosition = In>(
position: In,
options?: SpaceTransformationOptions,
): Out {
const config = options || {};
- 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
Consider simplifying this complex logical expression. Open
if (options) {
const ownMeta = JsonObjectMetadata.ensurePresentInPrototype(target);
const rootMeta = DataSerializerUtils.getRootMetadata(target.constructor);
const ownMemberMetadata = ownMeta.dataMembers.get(propertyKey) || ownMeta.dataMembers.get(options.name);
const rootMemberMetadata = rootMeta
Function weightedSum
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function weightedSum(ret, w1, v1, w2, v2) {
Function toString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
toString(byteLength?: number, padding: boolean = true): string {
byteLength = byteLength ?? this._raw.byteLength;
const bytes = [];
for (const [, value] of this._raw.entries()) {
bytes.push(value);
- 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 fromAxisAngle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static fromAxisAngle<T extends typeof Quaternion>(this: T, axis: any): InstanceType<T> {
const quaternion = new this();
if (axis instanceof AxisAngle) {
quaternion.setFromAxisAngle(new Vector3(axis.x, axis.y, axis.z), axis.angle);
} else if (axis instanceof Array) {
- 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 _convertSingleValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private _convertSingleValue(
sourceObject: any,
typeDescriptor: TypeDescriptor,
memberName?: string,
memberOptions?: ObjectMemberMetadata,
- 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
Avoid too many return
statements within this function. Open
return this.convertAsObject(
sourceObject,
typeDescriptor,
memberName,
this,
Function createWorker
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected createWorker(): Worker {
if (this.options.blob) {
const worker = new BlobWorker(this.options.worker as any, {
type: this.options.type === 'typescript' ? 'classic' : this.options.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"