Showing 1,021 of 5,444 total issues
Function advance
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public advance(ch: string): void {
const { chars, states, skippedStates, result } = this;
let stateToAdd: AnyState<T> | null = null;
let matchCount = 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
File routing-instruction.ts
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { InstructionParser } from './instruction-parser';
import { InstructionParameters, Parameters } from './instruction-parameters';
import { InstructionComponent } from './instruction-component';
import { ComponentAppellation, ComponentParameters, LoadInstruction } from '../interfaces';
import { RoutingScope } from '../routing-scope';
File binding-command.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IExpressionParser } from '@aurelia/expression-parser';
import { Protocol, camelCase, emptyArray, firstDefined, getResourceKeyFor, mergeArrays, resolve, resource, resourceBaseName, isString } from '@aurelia/kernel';
import { defineMetadata, getMetadata } from './utilities-metadata';
import { IAttrMapper } from './attribute-mapper';
import {
File logger.ts
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { createInterface, IContainer, IRegistry } from './di';
import { instanceRegistration, singletonRegistration } from './di.registration';
import { bound, toLookup } from './functions';
import { Class, Constructable } from './interfaces';
import { IPlatform } from './platform';
Function objEquiv
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export function objEquiv(
a: Object,
b: Object,
strict: boolean,
keys: PropertyKey[],
- 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 validation-result-presenter-service.spec.ts
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Registration, toArray, newInstanceForScope, DI, resolve, IContainer } from '@aurelia/kernel';
import { IPlatform, CustomElement, customElement, Aurelia } from '@aurelia/runtime-html';
import { PLATFORM, assert, ISpy, TestContext, createSpy, getVisibleText } from '@aurelia/testing';
import {
IValidationRules,
File router.lifecycle-hooks.spec.ts
has 375 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IContainer } from '@aurelia/kernel';
import { IRoute, IRouter, IRouterOptions, RouterConfiguration } from '@aurelia/router';
import { Aurelia, CustomElement, IPlatform, lifecycleHooks } from '@aurelia/runtime-html';
import { MockBrowserHistoryLocation, TestContext, assert } from '@aurelia/testing';
Function hydrate
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
public hydrate(raw: any): any {
switch (raw.$TYPE) {
case ASTExpressionTypes.AccessMemberExpression: {
const expr: Pick<AST.AccessMemberExpression, 'object' | 'name'> = raw;
return new AST.AccessMemberExpression(this.hydrate(expr.object), expr.name);
File template-compiler.hooks.spec.ts
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
Registration
} from '@aurelia/kernel';
import {
CustomElement,
Function getViewportHooks
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function getViewportHooks(swapStrategy: SwapStrategy, phase: string, viewport: Viewport, type: '' | 'activate' | 'deactivate' = ''): string[] {
const hooks = [];
switch (type) {
case 'activate':
if (!viewport.to.isEmpty) {
- 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 getMessageByCode
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
const getMessageByCode = (name: ErrorNames, ...details: unknown[]) => {
let cooked: string = errorsMap[name];
for (let i = 0; i < details.length; ++i) {
const regex = new RegExp(`{{${i}(:.*)?}}`, 'g');
let matches = regex.exec(cooked);
- 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 runner.ts
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { OpenPromise } from './open-promise';
/**
* Class for running a sequence of steps with values,
* functions and promises. Stays sync if possible.
File routing-hook.spec.ts
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { RoutingHook, RoutingInstruction, RouterConfiguration, IRouter, Navigation } from '@aurelia/router';
import { assert, TestContext } from '@aurelia/testing';
import { CustomElement, IPlatform, Aurelia } from '@aurelia/runtime-html';
import { isNode } from '../util.js';
File validation-errors-custom-attribute.spec.ts
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { newInstanceForScope, newInstanceOf, resolve, toArray } from '@aurelia/kernel';
import { assert, createSpy, getVisibleText, ISpy, TestContext } from '@aurelia/testing';
import { IValidationRules } from '@aurelia/validation';
import { CustomAttribute, CustomElement, customElement, IPlatform, Aurelia } from '@aurelia/runtime-html';
import {
File enhance.spec.ts
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
// This is to test for some intrinsic properties of enhance which is otherwise difficult to test in Data-driven tests parallel to `.app`
import { BrowserPlatform } from '@aurelia/platform-browser';
import { Constructable, DI, IContainer, Registration, onResolve, resolve } from '@aurelia/kernel';
import {
CustomElement,
File decorator-observable.spec.ts
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { observable, SetterObserver, IObservable, IObserverLocator, IObserver } from '@aurelia/runtime';
import { assert, createFixture } from '@aurelia/testing';
import { noop, resolve } from '@aurelia/kernel';
import { ValueConverter, customElement, watch } from '@aurelia/runtime-html';
File i18n.spec.ts
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { I18N, I18nInitOptions, Signals } from '@aurelia/i18n';
import { EventAggregator } from '@aurelia/kernel';
import { nowrap } from '@aurelia/runtime';
import { assert, MockSignaler, createFixture } from '@aurelia/testing';
import { ISignaler } from '@aurelia/runtime-html';
RoutingScope
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
export class RoutingScope {
/** @internal */
private static lastId = 0;
public id = ++RoutingScope.lastId;
File repeat.vc.bb.spec.ts
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IContainer } from '@aurelia/kernel';
import { valueConverter, bindingBehavior, Aurelia, CustomElement, ICustomElementController, IPlatform } from '@aurelia/runtime-html';
import { assert, TestContext } from '@aurelia/testing';
import { createSpecFunction, TestExecutionContext, TestFunction } from '../util.js';
File has-multi-bindings.unit.spec.ts
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Char } from '../util.js';
import { assert } from '@aurelia/testing';
describe('3-runtime-html/has-multi-bindings.unit.spec.ts', function () {
interface IBindingSpec {