Showing 1,020 of 5,369 total issues
Function matchSpecifiedViewport
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private static matchSpecifiedViewport(
routingInstructions: Collection<RoutingInstruction>,
availableEndpoints: (Viewport | ViewportScope)[],
matchedInstructions: RoutingInstruction[],
disregardViewports: boolean,
- 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 watch
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export function watch<T extends object = object, TV extends AnyMethod = AnyMethod>(
expressionOrPropertyAccessFn: PropertyKey | IDepCollectionFn<object>,
changeHandlerOrCallback?: PropertyKey | IWatcherCallback<T>,
): WatchClassDecorator<T> | WatchMethodDecorator<T, TV> {
if (expressionOrPropertyAccessFn == null) {
- 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 _hydrate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public _hydrate(): void {
if (this._lifecycleHooks!.hydrating != null) {
this._lifecycleHooks!.hydrating.forEach(callHydratingHook, this);
}
if (this._vmHooks._hydrating) {
- 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 register
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public register(container: IContainer): void {
let existingMapping = container.get(own(ICssClassMapping));
if (existingMapping == null) {
container.register(
instanceRegistration(ICssClassMapping, existingMapping = createLookup()),
- 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 parseArgs
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
async function parseArgs(args: string[]): Promise<null | HttpServerOptions> {
const cmd = args[0];
if (cmd === 'help') { return null; }
const configuration: HttpServerOptions = new HttpServerOptions();
- 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 instruction-parser.spec.ts
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IRouter, RouterConfiguration, RoutingInstruction } from '@aurelia/router';
import { CustomElement, Aurelia } from '@aurelia/runtime-html';
import { assert, MockBrowserHistoryLocation, TestContext } from '@aurelia/testing';
describe('router/instruction-parser.spec.ts', function () {
Function baseCase
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
const baseCase = /*@__PURE__*/(function () {
_START_CONST_ENUM();
const enum CharKind {
none = 0,
digit = 1,
Function runTest
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runTest(spec: ISpec) {
const { t1: [t1, t1c], t2: [t2, t2c], t3: [t3, t3c], t4: [t4, t4c] } = spec;
spec.configure();
it(`'${t1}' -> '${t2}' -> '${t3}' -> '${t4}'`, async function () {
const { router, hia, host, tearDown } = await createFixture(Root1, A, getDefaultHIAConfig, getRouterOptions);
Function verifyBindingInstructionsEqual
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function verifyBindingInstructionsEqual(actual: any, expected: any, errors?: string[], path?: string): any {
if (path === undefined) {
path = 'instruction';
}
if (errors === undefined) {
Function matchEndpoints
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static matchEndpoints(routingScope: RoutingScope, instructions: RoutingInstruction[], alreadyMatched: RoutingInstruction[], disregardViewports: boolean = false): IMatchEndpointsResult {
const matchedInstructions: RoutingInstruction[] = [];
// Get all the routing scopes owned by this scope
// TODO: Investigate if Infinity needs to be a timestamp
TestRouteViewModelBase
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export abstract class TestRouteViewModelBase implements ITestRouteViewModel {
public readonly $controller!: ICustomElementController<this>;
public get name(): string {
return this.$controller.definition.name;
}
TestVM
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class TestVM implements IViewModel {
public readonly $controller!: ICustomElementController<this>;
public get name(): string { return this.$controller.definition.name; }
public readonly bindingDI: DelayedInvoker<'binding'>;
TestRouteViewModelBase
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
export abstract class TestRouteViewModelBase implements ITestRouteViewModel {
public readonly $controller!: ICustomElementController<this>;
public viewport: Viewport;
public get name(): string {
return this.$controller.definition.name;
Consider simplifying this complex logical expression. Open
if (typeof configOrPath === 'string' || configOrPath instanceof Array) {
const path = ensureArrayOfStrings(configOrPath);
const redirectTo = Type?.redirectTo ?? null;
const caseSensitive = Type?.caseSensitive ?? false;
Function getHmrCode
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getHmrCode = (className: string): string => {
const code = `
import { Metadata as $$M } from '@aurelia/metadata';
import { Controller as $$C, CustomElement as $$CE, IHydrationContext as $$IHC } from '@aurelia/runtime-html';
Function deactivate
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public deactivate(
initiator: IHydratedController,
_parent: IHydratedController | null,
): void | Promise<void> {
let prevActivation: void | Promise<void> = void 0;
Function from
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static from(def: CustomElementDefinition | null, alias: string): ElementInfo | null {
if (def === null) {
return null;
}
let rec = elementInfoLookup.get(def);
- 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 jsonStringify
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function jsonStringify(
o: unknown,
ctx: { result: string },
): string {
if (ctx.result.length > 100) {
- 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 reduceToSingleString
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function reduceToSingleString(
ctx: IInspectContext,
output: string[],
base: string,
braces: [string, 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
Function verifyEqual
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function verifyEqual(actual: any, expected: any, depth?: number, property?: string, index?: number): any {
if (depth === undefined) {
depth = 0;
}
if (typeof expected !== 'object' || expected === null) {
- 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"